sf (version 0.5-2)

aggregate.sf: aggregate an sf object

Description

aggregate an sf object, possibly union-ing geometries

Usage

# S3 method for sf
aggregate(x, by, FUN, ..., do_union = TRUE, simplify = TRUE)

Arguments

x

object of class sf

by

(see aggregate): a list of grouping elements, each as long as the variables in the data frame x. The elements are coerced to factors before use.

FUN

function passed on to aggregate, in case ids was specified and attributes need to be grouped

...

arguments passed on to FUN

do_union

logical; should grouped geometries be unioned using st_union?

simplify

logical; see aggregate

Value

an sf object with aggregated attributes and geometries, with additional grouping variables having the names of names(ids) or named Group.i for ids[[i]]; see the data.frame method of aggregate.