{geodk}
provides access to Danish geospatial data.
You can install {geodk}
from r-universe with:
install.packages(
"geodk",
repos = c(
ropengov = "https://ropengov.r-universe.dev",
getOption("repos")
)
)
You can install the latest development version of {geodk}
from
GitHub with:
# install.packages("devtools")
devtools::install_github("rOpenGov/geodk")
{geodk}
provides to main sets of functions:
- Data retrieval
- Plotting
The plotting functions include plot_denmark()
which easily plots a
basic map of Denmark and returns it as a {ggplot2}
object for you to
edit. It also includes plot_region()
and plot_municipality()
which
plots a subset of Denmark with focus on provided regions or
municipalities.
library(geodk)
plot_denmark()
#> → Getting data on `regioner`. This usually takes 10.24s.
#> Fetching data from the API. This will take some time.
#> Reading data to `st`.
#> Converting map data to `sf` object
region <- plot_regions(region = c("Region Nordjylland", "Region Midtjylland"))
#> → Using cached response.
#> Change this behaviour by setting cache = FALSE
municipality <- plot_municipalities(municipality = c("Aarhus", "Favrskov", "Vejle"))
#> → Getting data on `kommuner`. This usually takes 13.13s.
#> Fetching data from the API. This will take some time.
#> Reading data to `st`.
#> Converting map data to `sf` object
library(patchwork)
region + municipality