Convert class between sf
/stars
-terra
See also
Other Helper functions:
datamod()
,
dep_check()
,
get_clip_ext()
,
par_def_q()
,
reproject_std()
,
reproject_to_raster()
Examples
if (FALSE) { # \dontrun{
library(sf)
library(stars)
library(terra)
options(sf_use_s2 = FALSE)
## generate a random raster
ras_rand <- terra::rast(nrow = 30, ncol = 30)
terra::values(ras_rand) <- runif(900)
stars_rand <- dep_switch(ras_rand)
stars_rand
inherits(sf_rand, "stars") # TRUE
# should return stars object
vec_rand <- terra::spatSample(ras_rand, size = 10L, as.points = TRUE)
sf_rand <- dep_switch(vec_rand)
inherits(sf_rand, "sf") # TRUE
sf_rand
# should return sf object
} # }