| Title: | Download and Analyze Spatial Development Data from 'INKAR' |
|---|---|
| Description: | A professional R interface to download and analyze spatial development indicators from the 'BBSR' 'INKAR' (Indicators and Maps for Spatial and Urban Development) database. Features a bilingual interactive wizard, fuzzy and normalized indicator search, multi-indicator downloads with automatic tidy merging (long/wide), guaranteed consistent output schema, robust disk caching with automatic retry, and 'ggplot2' themes for regional mapping. |
| Authors: | Omer Furkan Coban [aut, cre] (ORCID: <https://orcid.org/0009-0005-3623-7178>) |
| Maintainer: | Omer Furkan Coban <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 0.6.6 |
| Built: | 2026-06-29 14:59:24 UTC |
| Source: | https://github.com/cran/inkaR |
The inkaR package provides a user-friendly interface to access, search, and download statistical indicators from the INKAR (Indikatoren und Karten zur Raum- und Stadtentwicklung) database provided by the Federal Institute for Research on Building, Urban Affairs and Spatial Development (BBSR).
view_indicators(): Opens the list of available indicators in a viewer.
Supports German ("de") and English ("en") modes. Sorted by active status.
get_inkar_data(): API wrapper to fetch data for a specific indicator.
Supports auto-saving to CSV (csv = TRUE).
get_geographies(): Helper to list available spatial levels (e.g., Kreise, Gemeinden)
or regions within a level.
search_indicators(): Search for indicators by text pattern.
Explore: Use view_indicators() to find the Shortname (e.g., "001") or M_ID of the desired indicator.
Download: Use get_inkar_data("001", level="KRE", year=2021) or ranges (year=2010:2020) to fetch the data.
Export: Add csv = TRUE to get_inkar_data to save the result immediately.
Maintainer: Omer Furkan Coban [email protected] (ORCID)
Useful links:
if (interactive()) { # 1. View available indicators (German) view_indicators() # 2. View in English view_indicators("en") } # 3. Search for "GDP" (Bruttoinlandsprodukt) try(search_indicators("GDP", lang = "en")) # 4. Download data for GDP (011) for Districts (KRE) # Note: You can use Shortnames ("011"), numeric M_IDs (11), or simple codes ("bip") try(data <- get_inkar_data("011", level = "KRE", year = 2021, lang = "de", csv = FALSE)) # 5. Download and save directly as CSV try(get_inkar_data("011", csv = TRUE, export_dir = tempdir())) # 6. Download data for a year range try(get_inkar_data("011", level = "KRE", year = 2010:2020))if (interactive()) { # 1. View available indicators (German) view_indicators() # 2. View in English view_indicators("en") } # 3. Search for "GDP" (Bruttoinlandsprodukt) try(search_indicators("GDP", lang = "en")) # 4. Download data for GDP (011) for Districts (KRE) # Note: You can use Shortnames ("011"), numeric M_IDs (11), or simple codes ("bip") try(data <- get_inkar_data("011", level = "KRE", year = 2021, lang = "de", csv = FALSE)) # 5. Download and save directly as CSV try(get_inkar_data("011", csv = TRUE, export_dir = tempdir())) # 6. Download data for a year range try(get_inkar_data("011", level = "KRE", year = 2010:2020))
Clears the persistent disk cache used for API responses (like time reference metadata).
clear_inkar_cache()clear_inkar_cache()
No return value, called for side effects.
A specialized wrapper around compare_regions() to filter a data frame returned
by get_inkar_data() to rows matching specific district names or IDs (Kennziffer).
compare_districts(data, districts, exact = FALSE) compare_district(data, districts, exact = FALSE)compare_districts(data, districts, exact = FALSE) compare_district(data, districts, exact = FALSE)
data |
A data frame returned by |
districts |
Character/Numeric vector. District names, IDs, or partial patterns to keep. |
exact |
Logical. If |
A filtered tibble.
df <- try(get_inkar_data("011", level = "KRE", year = 2021, lang = "en")) if (is.data.frame(df)) compare_districts(df, c("Berlin", "Hamburg"))df <- try(get_inkar_data("011", level = "KRE", year = 2021, lang = "en")) if (is.data.frame(df)) compare_districts(df, c("Berlin", "Hamburg"))
Filters a data frame returned by get_inkar_data() to rows matching the
supplied region names (partial, case-insensitive match by default).
compare_regions(data, regions, exact = FALSE) compare_region(data, regions, exact = FALSE)compare_regions(data, regions, exact = FALSE) compare_region(data, regions, exact = FALSE)
data |
A data frame returned by |
regions |
Character vector. Region names or partial patterns to keep. |
exact |
Logical. If |
A filtered tibble.
df <- try(get_inkar_data("011", level = "KRE", year = 2021, lang = "en")) if (is.data.frame(df)) compare_regions(df, c("Berlin", "Hamburg"))df <- try(get_inkar_data("011", level = "KRE", year = 2021, lang = "en")) if (is.data.frame(df)) compare_regions(df, c("Berlin", "Hamburg"))
Retrieves a list of available spatial levels (if geography is NULL) or
a list of regions for a specific level (e.g., "KRE").
get_geographies(geography = NULL)get_geographies(geography = NULL)
geography |
Character. Spatial level code (e.g. "KRE"). If NULL, returns all levels. |
A data frame with ID and Name.
Returns a data frame of available indicators with bilingual support.
get_indicators(lang = c("de", "en"))get_indicators(lang = c("de", "en"))
lang |
Language code: "de" (German) or "en" (English). |
A tibble containing indicator IDs, names, and descriptions.
Retrieves statistical data for a given variable and spatial level. Automatically handles time reference lookup.
get_inkar_data( variable, level = "KRE", year = NULL, lang = c("de", "en"), format = c("long", "wide"), csv = FALSE, export_dir = NULL )get_inkar_data( variable, level = "KRE", year = NULL, lang = c("de", "en"), format = c("long", "wide"), csv = FALSE, export_dir = NULL )
variable |
Character. The indicator ID (Shortname), e.g., "011". |
level |
Character. Spatial level code (e.g., "KRE" for Kreise). |
year |
Integer/Character vector. Specific year (e.g., 2021) or range (e.g., 2010:2020). If NULL, fetches all available years. |
lang |
Character. "de" (default) for German column names, "en" for English. |
format |
Character. "long" (default) for tidy format, "wide" for years as columns. |
csv |
Logical. If TRUE, saves the data to a CSV file in the directory specified by |
export_dir |
Character. Directory to save the CSV file if |
A tibble containing the data.
Returns the unique theme/domain values present in the local indicators
dataset. Pass one of these values to the theme argument of
search_indicators() or view_indicators() to narrow results.
get_themes()get_themes()
A sorted character vector of theme names.
get_themes()get_themes()
A comprehensive list of available indicators from the INKAR database. This dataset is used to lookup indicator IDs, names, and descriptions.
indicatorsindicators
A data frame with the following columns:
Short identifier (e.g., "001")
Numeric internal ID used by API
German name of the indicator
English name (translated or placeholder)
Detailed German description
Detailed English description (available for 413 indicators)
Group/Domain of the indicator
Logical. TRUE if verified as active in the API
Algorithm used (if any)
Notes in German
Notes in English
Availability for Municipalities
Availability for Districts
Statistical basis (DE)
Statistical basis (EN)
Unit of measurement (DE)
Unit of measurement (EN)
A full-featured alias for get_inkar_data() with bilingual support and an
interactive wizard when called without arguments (in interactive sessions).
Call inkaR("011") to download directly, or inkaR() to open the wizard.
inkaR(variable = NULL, level = NULL, year = NULL, lang = c("de", "en"), ...)inkaR(variable = NULL, level = NULL, year = NULL, lang = c("de", "en"), ...)
variable |
Character. Indicator ID, shortname, or partial name.
If |
level |
Character. Spatial level code (e.g., |
year |
Integer/Character vector or |
lang |
Character. |
... |
Additional arguments passed to |
For a simpler English-first shortcut, see inkar().
A tibble containing the downloaded data, or NULL if selection was cancelled.
if (interactive()) { df <- inkaR() # opens interactive menu } try(df <- inkaR("bip", level = "KRE", year = 2021)) try(df <- inkaR("Bruttoinlandsprodukt", level = "KRE"))if (interactive()) { df <- inkaR() # opens interactive menu } try(df <- inkaR("bip", level = "KRE", year = 2021)) try(df <- inkaR("Bruttoinlandsprodukt", level = "KRE"))
A convenience wrapper around get_inkar_data() with English output and
year = "latest" as defaults. Equivalent to calling
get_inkar_data(variable, level, year = "latest", lang = "en").
inkar(variable, level = "KRE", year = "latest", lang = "en", ...)inkar(variable, level = "KRE", year = "latest", lang = "en", ...)
variable |
Character. Indicator ID, short name, or partial name. |
level |
Character. Spatial level code (default |
year |
Integer/Character vector or |
lang |
Character. Output language (default |
... |
Additional arguments passed to |
A tibble with English column names.
try(df <- inkar("011", level = "KRE")) try(df <- inkar("011", level = "KRE", year = 2019:2021))try(df <- inkar("011", level = "KRE")) try(df <- inkar("011", level = "KRE", year = 2019:2021))
Creates a ggplot2 line chart showing how indicator values change over time
for selected regions. Input must be a long-format data frame from
get_inkar_data().
inkar_trends(data, regions = NULL, title = NULL, mode = c("light", "dark"))inkar_trends(data, regions = NULL, title = NULL, mode = c("light", "dark"))
data |
A long-format data frame from |
regions |
Optional character vector. Region names (partial match) to
include. If |
title |
Optional character. Custom plot title. Defaults to indicator name. |
mode |
Character. |
A ggplot2 object.
df <- try(get_inkar_data("011", level = "KRE", lang = "en")) if (is.data.frame(df)) { inkar_trends(df, regions = c("Berlin", "Hamburg", "München")) }df <- try(get_inkar_data("011", level = "KRE", lang = "en")) if (is.data.frame(df)) { inkar_trends(df, regions = c("Berlin", "Hamburg", "München")) }
Automatically projects regional INKAR data onto administrative boundaries of Germany using
the geodata and sf packages. Supports Bund (BND), Bundeslaender (BLD), Kreise (KRE),
and Gemeinden (GEM) levels. Alternatively, a custom sf geometry can be provided.
plot_inkar( data, variable = NULL, year = NULL, mode = c("light", "dark"), highlight = NULL, breaks = c("equal", "quantile"), title = NULL, geom = NULL )plot_inkar( data, variable = NULL, year = NULL, mode = c("light", "dark"), highlight = NULL, breaks = c("equal", "quantile"), title = NULL, geom = NULL )
data |
A data frame returned by |
variable |
Character. For wide-format data with multiple indicators, specify which indicator column to plot. |
year |
Integer/Character. If the data contains multiple years, specify which year to plot. If NULL and multiple years exist, the most recent year is plotted. |
mode |
Character. "light" (default) or "dark" theme. |
highlight |
Character vector. Region names (partial match) to highlight; all other regions are shown at reduced opacity. |
breaks |
Character. Color scale break method: |
title |
Character. Custom plot title. Defaults to the indicator name. |
geom |
Optional |
A ggplot2 object displaying the mapped data.
Search for indicators by keyword. Prints a formatted table and invisibly
returns the matches so you can copy the ID for use in inkaR().
search_indicators(pattern, lang = c("de", "en"), theme = NULL)search_indicators(pattern, lang = c("de", "en"), theme = NULL)
pattern |
Text to search in names and descriptions. |
lang |
Language to search in ("de" or "en"). |
theme |
Optional character. Filter to a specific theme/domain before
searching. Use |
A filtered tibble of indicators (invisibly).
Opens a GUI selection list (e.g., in RStudio) to browse and pick an indicator.
For code-based workflows, use inkaR("name") or search_indicators() instead.
select_indicator(pattern = NULL, lang = c("de", "en"))select_indicator(pattern = NULL, lang = c("de", "en"))
pattern |
Optional character. Pre-filter the list by a keyword or regex.
If |
lang |
Language for names: |
Character. The selected indicator ID, or NULL if cancelled.
Provides an interactive console menu to choose an INKAR spatial level. If a variable ID is provided, it probes the live API to find which levels actually have data for that indicator.
select_level(variable = NULL)select_level(variable = NULL)
variable |
Optional character. The indicator ID to probe available levels. |
Character. The selected level ID, e.g., "KRE".
Probes the API for available years for a specific indicator and level, then allows the user to select one or more years.
select_years(variable, level)select_years(variable, level)
variable |
Indicator ID. |
level |
Spatial level ID. |
Character vector of years.
Premium ggplot2 theme for inkaR
theme_inkaR(mode = c("light", "dark"), base_size = 11)theme_inkaR(mode = c("light", "dark"), base_size = 11)
mode |
Character. "light" or "dark". |
base_size |
Numeric. Base font size. |
Checks the INKAR API for new indicators not present in the local
indicators dataset. The check is informational only; reinstall
the package to permanently add new indicators to local metadata.
update_indicators(lang = c("de", "en"))update_indicators(lang = c("de", "en"))
lang |
Character. Language for messages: |
Invisibly returns the local indicators tibble.
Opens the available indicators in the RStudio data viewer for easy filtering and searching.
view_indicators(lang = c("de", "en"), theme = NULL)view_indicators(lang = c("de", "en"), theme = NULL)
lang |
Language code: "de" (German) or "en" (English). |
theme |
Optional character. Filter to a specific theme/domain before
opening the viewer. Use |
Invokes View() on the data frame.