Skip to contents

A geolevel object is created from a given geographic layer. The attributes of the layer to be included in the level can be indicated; if no attribute is indicated, all are considered. The attributes that make up the key must be indicated.

Usage

geolevel(
  name = NULL,
  layer = NULL,
  attributes = NULL,
  key = NULL,
  snake_case = FALSE
)

Arguments

name

A string, level name.

layer

A tibble or sf object.

attributes

A string vector, selected attributes.

key

A string vector, attributes that compose the key.

snake_case

A boolean, transform all names to snake_case.

Value

A geolevel object.

Details

A level can have two associated geometries (point or polygon). The geometry is obtained from the layer data.

We can also define a level from a tibble, which does not have any associated geometry. The geometry will be obtained from the relationships between levels that we define or from layers related to this data.

The name of the level is used later to reference it and relate it to other levels.

Examples


layer_us_state <- get_level_layer(gd_us, "state")

state <-
  geolevel(name = "state",
           layer = layer_us_state,
           key = "statefp",
           snake_case = TRUE)