https://github.com/ropengov/geodk
R package for danish geographic data
https://github.com/ropengov/geodk
denmark denmark-map geodk geospatial r r-lang
Last synced: 3 months ago
JSON representation
R package for danish geographic data
- Host: GitHub
- URL: https://github.com/ropengov/geodk
- Owner: rOpenGov
- License: gpl-3.0
- Created: 2024-10-21T07:35:31.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-03-11T15:09:23.000Z (about 1 year ago)
- Last Synced: 2025-04-14T23:09:52.096Z (about 1 year ago)
- Topics: denmark, denmark-map, geodk, geospatial, r, r-lang
- Language: R
- Homepage: http://ropengov.github.io/geodk/
- Size: 31.2 MB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.Rmd
- Changelog: NEWS.md
- License: LICENSE.md
Awesome Lists containing this project
README
---
output: github_document
---
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```
# geodk
[](https://ropengov.r-universe.dev/geodk)
[](https://github.com/rOpenGov/geodk/actions/workflows/R-CMD-check.yaml)
[](https://app.codecov.io/gh/ropengov/geodk)
[](https://www.repostatus.org/#wip)
[](https://ropengov.org/)
`{geodk}` provides access to Danish geospatial data.
## Installation
```{r check_cran, include=FALSE}
if (!require(available)) install.packages("available")
is_on_cran <- !available::available_on_cran("geodk")
```
```{r cran_instruct, echo=FALSE, results='asis', eval=is_on_cran}
cat("You can install `{geodk}` from CRAN with:")
```
```{r cran_code, eval=FALSE, include=is_on_cran}
install.packages("geodk")
```
```{r r_universe_instruct, echo=FALSE, results='asis'}
if (is_on_cran) {
cat("Or you can install the latest pre-release version of `{geodk}` from r-universe with:")
} else if (!is_on_cran) {
cat("You can install `{geodk}` from r-universe with:")
}
```
```{r r_universe, eval=FALSE}
install.packages(
"geodk",
repos = c(
ropengov = "https://ropengov.r-universe.dev",
getOption("repos")
)
)
```
You can install the latest development version of `{geodk}` from [GitHub](https://github.com/rOpenGov/geodk) with:
``` r
# install.packages("devtools")
devtools::install_github("rOpenGov/geodk")
```
## Functions
`{geodk}` provides three main sets of functions:
- Data retrieval
- Plotting
- Enrichment of statistical data from `{dkstat}`
### Data retrieval
The package contains a few functions for retrieving data.
```{r eval=FALSE}
regions()
municipalities()
parishes()
constituencies()
```
The geographic levels not included in their own functions can be accessed through `get_geo()`.
```{r eval=FALSE}
get_geo()
prefill_cache()
```
### 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.
```{r example}
library(geodk)
plot_denmark()
```
```{r}
region <- plot_regions(region = c("Region Nordjylland", "Region Midtjylland"))
```
```{r}
municipality <- plot_municipalities(municipality = c("Aarhus", "Favrskov", "Vejle"))
```
```{r}
library(patchwork)
region + municipality
```
### Enrichment of statistical data from `{dkstat}`
The function `geodk_enrich()` enables you to add appropriate geographic information to statistical descriptions from the `{dkstat}` package.
```{r eval=FALSE}
dkstat::dst_get_all_data("laby01") |>
geodk::geodk_enrich()
```