Learn R Programming

terra (version 1.8-5)

na.omit: Find and remove geometries that are NA

Description

Find geometries that are NA; or remove geometries and/or records that are NA.

Usage

# S4 method for SpatVector
is.na(x)

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

Value

SpatVector

Arguments

x

SpatVector

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

Examples

Run this code
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