Learn R Programming

geometr (version 0.1.1)

getSubset: Get the subset of a spatial object.

Description

Get the subset of a spatial object.

Usage

# S4 method for ANY
getSubset(x)

# S4 method for geom getSubset(x, ..., slot = "feature")

# S4 method for Spatial getSubset(x, ...)

# S4 method for sf getSubset(x, ...)

Arguments

x

object to subset.

...

Logical predicates defined in terms of the variables in x or a vector of booleans. Multiple conditions are combined with &. Only rows where the condition evaluates to TRUE are kept.

slot

[character(1)] the slot in which to determine a subset, either "point" for vertices, "feature" for features or "group" for group tables.

Value

A subset of x in its original class.

See Also

Other getters: getCRS, getExtent, getHistory, getPoints, getTable, getType, getWindow

Examples

Run this code
# NOT RUN {
# get the subset of a geom
obj <- gtGeoms$point

# the first feature
getSubset(x = gtGeoms$line, fid == 1)

# get the subset of a Spatial object
getSubset(x = gtSP$SpatialPolygonsDataFrame,
          a == 2)

# get the subset of an sf object
getSubset(x = gtSF$polygon, a == 1)
# }

Run the code above in your browser using DataLab