View source: R/arrange-SpatVector.R
arrange.SpatVector | R Documentation |
SpatVector
using column valuesarrange.SpatVector()
orders the geometries of a SpatVector
by the
values of selected columns.
## S3 method for class 'SpatVector'
arrange(.data, ..., .by_group = FALSE)
.data |
A |
... |
< |
.by_group |
If |
A SpatVector
object.
terra::sort()
Implementation of the generic dplyr::arrange()
function for
SpatVector
class.
dplyr::arrange()
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()
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.