R spatial class or to a shapefileR/cast_vect.R
cast_vect.Rdfunction to automatically re-cast a "vector" object to a given
"class" specified by the to argument.
cast_vect(object, to) # S3 method for default cast_vect(object, to) # S3 method for sf cast_vect(object, to) # S3 method for sfc cast_vect(object, to) # S3 method for Spatial cast_vect(object, to) # S3 method for character cast_vect(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 vector file and reads it to a sf or Spatial
object through sprawl::read_vect
#EXAMPLE1