Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

gt_filter

Subset a geometric object using column values


Description

This function allows to subset any geometric object for which all required getters are available.

Usage

gt_filter(obj, ..., update = TRUE)

Arguments

obj

[geometric object(1)]
the object to derive a subset from.

...

subset based on logical predicates defined in terms of the columns in x (of both, points, features and groups). Multiple conditions are combined with &. Only rows where the condition evaluates to TRUE are kept.

update

[logical(1)]
whether or not to update the window slot after deriving the subset.

Value

geom of the subset of obj.

See Also

Other geometry tools: gt_locate(), gt_pull(), gt_reflect(), gt_rotate(), gt_scale(), gt_skew(), gt_stretch(), gt_translate()

Examples

# get a subset of a geom
gt_filter(gtGeoms$point, y < -10)

# get a subset of an sf-object
gt_filter(obj = gtSF$multilinestring, a == 1)

geometr

Generate and Modify Interoperable Geometric Shapes

v0.2.10
GPL-3
Authors
Steffen Ehrmann [aut, cre] (<https://orcid.org/0000-0002-2958-0796>), Dan Sunday [cph] (fast point-in-polygon algorithm.)
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.