R/cast_rast.R
cast_rast.Rdfunction to automatically re-cast between Raster object and raster files on disk
cast_rast(object, to) # S3 method for default cast_rast(object, to) # S3 method for Raster cast_rast(object, to) # S3 method for character cast_rast(object, to)
| object | either an |
|---|---|
| to |
|
returns the same object, casted to the "class" specified by to (or the exact same
object in case object is already of "class" to)
If object is a valid R spatial object, it is automatically converted to an object of
a different class if needed (e.g., from sf to Spatial and viceversa, or from sf to a
vector file through sprawl::write_shape). If it is a character string, the function checks if
it corresponds to a valid raster file and reads it to a Raster object through
rasterr::stack()
#EXAMPLE1