add_level {geodimension} | R Documentation |
Add a level to a dimension
Description
Once a level is part of the dimension, it can then be related to other levels of the dimension.
Usage
add_level(gd, level)
## S3 method for class 'geodimension'
add_level(gd, level = NULL)
Arguments
gd |
A |
level |
A |
Value
A geodimension
.
See Also
geolevel
, relate_levels
, get_level_layer
Other geodimension definition functions:
geodimension()
,
set_level_data()
,
transform_crs()
Examples
layer_us_place <- gd_us |>
get_level_layer("place")
layer_us_county <-
dplyr::inner_join(
get_level_data_geo(gd_us, "county"),
get_level_layer(gd_us, "county"),
by = c("geoid", "statefp", "name", "type")
) |>
sf::st_as_sf()
place <-
geolevel(name = "place",
layer = layer_us_place,
attributes = c("statefp", "county_geoid", "name", "type"),
key = "geoid")
county <-
geolevel(
name = "county",
layer = layer_us_county,
attributes = c("statefp", "name", "type"),
key = "geoid"
) |>
add_geometry(coordinates_to_geometry(layer_us_county,
lon_lat = c("intptlon", "intptlat")))
gd_us <-
geodimension(name = "gd_us",
level = place) |>
add_level(level = county)
[Package geodimension version 2.0.0 Index]