arrange.SpatVector {tidyterra} | R Documentation |
Order a SpatVector
using column values
Description
arrange.SpatVector()
orders the geometries of a SpatVector
by the
values of selected columns.
Usage
## S3 method for class 'SpatVector'
arrange(.data, ..., .by_group = FALSE)
Arguments
.data |
A |
... |
< |
.by_group |
If |
Value
A SpatVector
object.
terra equivalent
Methods
Implementation of the generic dplyr::arrange()
function for
SpatVector
class.
See Also
Other single table verbs:
filter.Spat
,
mutate.Spat
,
rename.Spat
,
select.Spat
,
slice.Spat
,
summarise.SpatVector()
Other dplyr verbs that operate on rows:
distinct.SpatVector()
,
filter.Spat
,
slice.Spat
Other dplyr methods:
bind_cols.SpatVector
,
bind_rows.SpatVector
,
count.SpatVector()
,
distinct.SpatVector()
,
filter-joins.SpatVector
,
filter.Spat
,
glimpse.Spat
,
group-by.SpatVector
,
mutate-joins.SpatVector
,
mutate.Spat
,
pull.Spat
,
relocate.Spat
,
rename.Spat
,
rowwise.SpatVector()
,
select.Spat
,
slice.Spat
,
summarise.SpatVector()
Examples
library(terra)
library(dplyr)
v <- vect(system.file("extdata/cyl.gpkg", package = "tidyterra"))
# Single variable
v %>%
arrange(desc(iso2))
# Two variables
v %>%
mutate(even = as.double(cpro) %% 2 == 0, ) %>%
arrange(desc(even), desc(iso2))
# With new variables
v %>%
mutate(area_geom = terra::expanse(v)) %>%
arrange(area_geom)