Last chance! 50% off unlimited learning
Sale ends in
Remove empty geometries and/or records that are NA
from a SpatVector.
# S4 method for SpatVector
na.omit(object, field=NA, geom=FALSE)
SpatVector
character or NA. If NA
, missing values in the attributes are ignored. Other values are either one or more field (variable) names, or ""
to consider all fields
logical. If TRUE
empty geometries are removed
SpatVector
# NOT RUN {
f <- system.file("ex/lux.shp", package="terra")
v <- vect(f)
v$test <- c(1,2,NA)
nrow(v)
x <- na.omit(v, "test")
nrow(x)
# }
Run the code above in your browser using DataLab