Learn R Programming

reproducible (version 1.2.16)

writeOutputs: Write module inputs on disk

Description

Can be used to write prepared inputs on disk.

Usage

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, ...)

Value

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.

Arguments

x

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

filename2

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

overwrite

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

...

Passed into raster::shapefile() or raster::writeRaster() or sf::st_write()

verbose

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

Author

Eliot McIntire and Jean Marchal

Examples

Run this code
library(sp)
library(raster)
r <- raster::raster(extent(0,100,0,100), vals = 1:1e2)

tf <- tempfile(fileext = ".tif")
writeOutputs(r, tf)

Run the code above in your browser using DataLab