Can be used to write prepared inputs on disk.
writeOutputs(
x,
filename2,
overwrite = getOption("reproducible.overwrite", NULL),
...
)
# S3 method for Raster
writeOutputs(
x,
filename2 = NULL,
overwrite = getOption("reproducible.overwrite", FALSE),
verbose = getOption("reproducible.verbose", 1),
...
)
# S3 method for Spatial
writeOutputs(
x,
filename2 = NULL,
overwrite = getOption("reproducible.overwrite", TRUE),
...
)
# S3 method for sf
writeOutputs(
x,
filename2 = NULL,
overwrite = getOption("reproducible.overwrite", FALSE),
verbose = getOption("reproducible.verbose", 1),
...
)
# S3 method for quosure
writeOutputs(x, filename2, ...)
# S3 method for default
writeOutputs(x, filename2, ...)
The object save to disk i.e., write outputs
File name passed to raster::writeRaster()
, or
raster::shapefile()
or sf::st_write()
(dsn
argument).
Logical. Should file being written overwrite an existing file if it exists.
Passed into raster::shapefile()
or
raster::writeRaster()
or sf::st_write()
Numeric, -1 silent (where possible), 0 being very quiet,
1 showing more messaging, 2 being more messaging, etc.
Default is 1. Above 3 will output much more information about the internals of
Caching, which may help diagnose Caching challenges. Can set globally with an
option, e.g., options('reproducible.verbose' = 0) to reduce to minimal
A GIS file (e.g., RasterLayer, SpatRaster etc.) that has been appropriately written to disk. In the case of vector datasets, this will be a side effect. In the case of gridded objects (Raster*, SpatRaster), the object will have a file-backing.
library(sp)
library(raster)
r <- raster::raster(extent(0,100,0,100), vals = 1:1e2)
tf <- tempfile(fileext = ".tif")
writeOutputs(r, tf)
#> writing to disk
#> No 'datatype' chosen. Saving layer as INT1U
#> Writing /tmp/Rtmp56YhgE/file1ee42be87462.tif to disk ...
#> class : RasterLayer
#> dimensions : 10, 10, 100 (nrow, ncol, ncell)
#> resolution : 10, 10 (x, y)
#> extent : 0, 100, 0, 100 (xmin, xmax, ymin, ymax)
#> crs : NA
#> source : file1ee42be87462.tif
#> names : layer
#> values : 1, 100 (min, max)
#>