diff --git a/R/GOC.R b/R/GOC.R index 8eb4bf5..9425d4b 100644 --- a/R/GOC.R +++ b/R/GOC.R @@ -95,11 +95,12 @@ #' tinyPatchGOC <- GOC(tinyPatchMPG, nThresh = 5) #' #' ## Examine the properties of the GOC graph of grain 3 of 5 -#' print(tinyPatchGOC@th[[3]]$goc, vertex = TRUE, edge = TRUE) +#' graphdf(grain(tinyPatchGOC, nThresh = 3)) #' -#' ## Extract specified grains of connectivity and produce a vector SpatialPolygons -#' ## representation of the finest grain of connectivity (Threshold = 0) -#' tinyPatchGOC <- GOC(tinyPatchMPG, doThresh = c(0, 20, 40), sp = TRUE) +#' ## Extract grains of connectivity +#' ## representation of the finest grain and three others +#' ## by giving thresholds in link weights (doThresh) +#' tinyPatchGOC <- GOC(tinyPatchMPG, doThresh = c(0, 20, 40)) #' } #' setGeneric("GOC", function(x, ...) { diff --git a/R/export.R b/R/export.R index 264754b..9264fbe 100644 --- a/R/export.R +++ b/R/export.R @@ -194,8 +194,10 @@ #' export(tinyPatchMPG) #' #' ## Export raster and vectors of a grain to a specified directory -#' tmpDir <- file.path(tempdir(), "tiny_goc_thresh2") -#' export(grain(tinyPatchGOC, 2), dirname = tmpDir) +#' export(grain(tinyPatchGOC, 2), dirname = "tiny_goc_thresh2", path = tempdir()) +#' +#' ## Export rasters and vectors of the MPG and place in an R object +#' sp_tinyPatchMPG <- export(tinyPatchMPG, R = TRUE) #' } #' setGeneric( diff --git a/man/GOC.Rd b/man/GOC.Rd index f2cf5e2..31042ba 100644 --- a/man/GOC.Rd +++ b/man/GOC.Rd @@ -79,11 +79,12 @@ tinyPatchMPG <- MPG(cost = tinyCost, patch = (tinyCost == 1)) tinyPatchGOC <- GOC(tinyPatchMPG, nThresh = 5) ## Examine the properties of the GOC graph of grain 3 of 5 -print(tinyPatchGOC@th[[3]]$goc, vertex = TRUE, edge = TRUE) +graphdf(grain(tinyPatchGOC, nThresh = 3)) -## Extract specified grains of connectivity and produce a vector SpatialPolygons -## representation of the finest grain of connectivity (Threshold = 0) -tinyPatchGOC <- GOC(tinyPatchMPG, doThresh = c(0, 20, 40), sp = TRUE) +## Extract grains of connectivity +## representation of the finest grain and three others +## by giving thresholds in link weights (doThresh) +tinyPatchGOC <- GOC(tinyPatchMPG, doThresh = c(0, 20, 40)) } } diff --git a/man/export.Rd b/man/export.Rd index d01bd0a..cadfa4f 100644 --- a/man/export.Rd +++ b/man/export.Rd @@ -1,11 +1,12 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/export.R +% Please edit documentation in R/export.R, R/patchfilter.R \docType{methods} \name{export} \alias{export} \alias{export,mpg-method} \alias{export,grain-method} \alias{export,goc-method} +\alias{patchfilter,RasterLayer-method} \title{Export spatial data from MPG and GOC models} \usage{ export(x, dirname = NULL, path = ".", rasterFormat = "GTiff", @@ -22,6 +23,8 @@ export(x, dirname = NULL, path = ".", rasterFormat = "GTiff", \S4method{export}{goc}(x, dirname = NULL, path = ".", rasterFormat = "GTiff", overwrite = FALSE, R = FALSE, vorBound = FALSE, ...) + +\S4method{patchfilter}{RasterLayer}(x, cells = NULL, area = NULL, ...) } \arguments{ \item{x}{A \code{mpg} or \code{grain} object} @@ -170,8 +173,10 @@ tinyPatchGOC <- GOC(tinyPatchMPG, nThresh = 5) export(tinyPatchMPG) ## Export raster and vectors of a grain to a specified directory -tmpDir <- file.path(tempdir(), "tiny_goc_thresh2") -export(grain(tinyPatchGOC, 2), dirname = tmpDir) +export(grain(tinyPatchGOC, 2), dirname = "tiny_goc_thresh2", path = tempdir()) + +## Export rasters and vectors of the MPG and place in an R object +sp_tinyPatchMPG <- export(tinyPatchMPG, R = TRUE) } }