Can be used to write prepared inputs on disk.

writeOutputs(x, filename2, overwrite, ...)

# S3 method for Raster
writeOutputs(x, filename2 = NULL, overwrite = FALSE,
  ...)

# S3 method for Spatial
writeOutputs(x, filename2 = NULL, overwrite = FALSE,
  ...)

# S3 method for sf
writeOutputs(x, filename2 = NULL, overwrite = FALSE, ...)

# S3 method for default
writeOutputs(x, filename2, ...)

Arguments

x

The object save to disk i.e., write outputs

filename2

File name passed to writeRaster, or shapefile or st_write (dsn argument).

overwrite

Logical. Should file being written overwrite an existing file if it exists.

...

Passed into shapefile or writeRaster or st_write

Examples

# Add a study area to Crop and Mask to # Create a "study area" library(sp) library(raster) ow <- setwd(tempdir()) # make a SpatialPolygon coords1 <- structure(c(-123.98, -117.1, -80.2, -100, -123.98, 60.9, 67.73, 65.58, 51.79, 60.9), .Dim = c(5L, 2L)) Sr1 <- Polygon(coords1) Srs1 <- Polygons(list(Sr1), "s1") shpEcozone <- SpatialPolygons(list(Srs1), 1L) crs(shpEcozone) <- "+init=epsg:4326 +proj=longlat +datum=WGS84 +no_defs +ellps=WGS84 +towgs84=0,0,0" # make a "study area" that is subset of larger dataset coords <- structure(c(-118.98, -116.1, -99.2, -106, -118.98, 59.9, 65.73, 63.58, 54.79, 59.9), .Dim = c(5L, 2L)) Sr1 <- Polygon(coords) Srs1 <- Polygons(list(Sr1), "s1") StudyArea <- SpatialPolygons(list(Srs1), 1L) crs(StudyArea) <- "+init=epsg:4326 +proj=longlat +datum=WGS84 +no_defs +ellps=WGS84 +towgs84=0,0,0" #' #' ########## shpEcozonePostProcessed <- postProcess(shpEcozone, studyArea = StudyArea)
#> No cacheRepo supplied. Using value in getOption('reproducible.cachePath')
#> loading cached result from previous cropInputs call, adding to memoised copy
#> Checking for errors in SpatialPolygon
#> Found no errors.
#> No cacheRepo supplied. Using value in getOption('reproducible.cachePath')
#> loading cached result from previous projectInputs call, adding to memoised copy
#> No cacheRepo supplied. Using value in getOption('reproducible.cachePath')
#> loading cached result from previous maskInputs call, adding to memoised copy
#> Saving output to ./Smallfile6fc86d4239a7. Specify filename1 or filename2 for more control
#' # Try manually, individual pieces shpEcozoneReprojected <- projectInputs(shpEcozone, StudyArea) shpEcozoneCropped <- cropInputs(shpEcozone, StudyArea)
#> cropping ...
shpEcozoneClean <- fixErrors(shpEcozone)
#> Checking for errors in SpatialPolygon
#> Found no errors.
shpEcozoneMasked <- maskInputs(shpEcozone, StudyArea)
#> intersecting ...
#> Checking for errors in studyArea
#> Found no errors.
setwd(ow)