union_tidy: Aggregate polygons in a tidy data frame with map coordinates

Description Usage Arguments Value Examples

Description

Combine tidy2sp, union_polygons and broom::tidy, returning a tidy data frame with aggregated polygons, based on a new_id vector.

Usage

1
union_tidy(.data, new_id)

Arguments

.data

data frame with map coordinates of polygons

new_id

A vector defining the output Polygons objects, equal in length to the length of the polygons slot of .sp; it may be character, integer, or factor

Value

a data frame with map coordinates of aggregated polygons

Examples

1
2
3
4
5
6
data(g1k15)

# Aggregate cantons into grand regions
grand_regions <- unique(g1k15[ , c("KTNR", "GRNR")])[["GRNR"]]
g1k15_union <- union_tidy(g1k15, new_id = grand_regions)
str(g1k15_union)

gibonet/tidy2spatial documentation built on May 17, 2019, 4:20 a.m.