Skip to contents

Stores an sfc on the object, aligned to @leaves row order.

Usage

geo_attach_geometry(x, geom, by = NULL, level = NULL)

Arguments

x

A Geoscale.

geom

An sf object or sfc. When sf with a code column, it is matched on by; when sfc, it must already be in @leaves row order.

by

Name of the code column in geom to match on. Defaults to the atom level, then "region".

level

Level that geom's codes refer to. Defaults to the atom level. When coarser, each atom inherits its parent's geometry.

Value

A Geoscale with @geometry populated.

Examples

if (FALSE) { # \dontrun{
gs <- geo_attach_geometry(gs, sf_polygons, by = "adm0_a3")
} # }