
Last chance! 50% off unlimited learning
Sale ends in
Select a subset of variables or records from a SpatVector.
# S4 method for SpatVector
subset(x, subset, drop=FALSE, ...)
SpatVector
logical expression indicating elements or rows to keep: missing values are taken as false
logical. If TRUE
, the geometries will be dropped, and a data.frame is returned
Additional arguments. None implemented
SpatVector or data.frame (if drop=TRUE
)
# NOT RUN {
f <- system.file("exdata/lux.shp", package="terra")
v <- vect(f)
v[2:3,]
v[,2:3]
subset(v, v$NAME_1 == "Diekirch")
# }
Run the code above in your browser using DataLab