na.omit: na.omit for SpatVector

Description Usage Arguments Value Examples

Description

Remove empty geometries and/or records that are NA from a SpatVector.

Usage

1
2
## S4 method for signature 'SpatVector'
na.omit(object, field=NA, geom=FALSE)

Arguments

object

SpatVector

field

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

geom

logical. If TRUE empty geometries are removed

Value

SpatVector

Examples

1
2
3
4
5
6
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)

terra documentation built on Aug. 20, 2021, 9:07 a.m.