| Title: | Download and Analyze Spatial Development Data from INKAR |
| Version: | 0.4.3 |
| Description: | A lightweight package to download spatial development indicators from the BBSR INKAR (Indikatoren und Karten zur Raum- und Stadtentwicklung) database. It provides a modern interface using 'httr2', robust caching, concurrent API querying for fast spatial dimension lookups, and native geospatial mapping integration. |
| URL: | https://github.com/ofurkancoban/inkaR |
| BugReports: | https://github.com/ofurkancoban/inkaR/issues |
| License: | MIT + file LICENSE |
| Encoding: | UTF-8 |
| LazyData: | true |
| RoxygenNote: | 7.3.3 |
| Imports: | httr2, jsonlite, tibble, dplyr, rlang, tidyr, utils |
| Suggests: | readxl, testthat (≥ 3.0.0), knitr, rmarkdown, sf, geodata, ggplot2, httptest2 |
| VignetteBuilder: | knitr |
| Depends: | R (≥ 4.1.0) |
| Config/testthat/edition: | 3 |
| NeedsCompilation: | no |
| Packaged: | 2026-03-09 14:18:21 UTC; ofurkancoban |
| Author: | Omer Furkan Coban |
| Maintainer: | Omer Furkan Coban <oemer.furkan.coban@uni-oldenburg.de> |
| Repository: | CRAN |
| Date/Publication: | 2026-03-13 13:10:08 UTC |
inkaR: Access the INKAR Database of the BBSR
Description
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).
Main Functions
-
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.
Usage Workflow
-
Explore: Use
view_indicators()to find theShortname(e.g., "001") orM_IDof 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 = TRUEtoget_inkar_datato save the result immediately.
Author(s)
Maintainer: Omer Furkan Coban oemer.furkan.coban@uni-oldenburg.de (ORCID)
See Also
Useful links:
Examples
if (interactive()) {
# 1. View available indicators (German)
view_indicators()
# 2. View in English
view_indicators("en")
}
# 3. Search for "GDP" (Bruttoinlandsprodukt)
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")
data <- get_inkar_data("011", level = "KRE", year = 2021, lang = "de", csv = FALSE)
# 5. Download and save directly as CSV
get_inkar_data("011", csv = TRUE, export_dir = tempdir())
# 6. Download data for a year range
get_inkar_data("011", level = "KRE", year = 2010:2020)
Clear INKAR Cache
Description
Clears the persistent disk cache used for API responses (like time reference metadata).
Usage
clear_inkar_cache()
Value
No return value, called for side effects.
Get Available Geographies or Region List
Description
Retrieves a list of available spatial levels (if geography is NULL) or
a list of regions for a specific level (e.g., "KRE").
Usage
get_geographies(geography = NULL)
Arguments
geography |
Character. Spatial level code (e.g. "KRE"). If NULL, returns all levels. |
Value
A data frame with ID and Name.
List Available Indicators
Description
Returns a data frame of available indicators with bilingual support.
Usage
get_indicators(lang = c("de", "en"))
Arguments
lang |
Language code: "de" (German) or "en" (English). |
Value
A tibble containing indicator IDs, names, and descriptions.
Download Data from INKAR
Description
Retrieves statistical data for a given variable and spatial level. Automatically handles time reference lookup.
Usage
get_inkar_data(
variable,
level = "KRE",
year = NULL,
lang = c("de", "en"),
format = c("long", "wide"),
csv = FALSE,
export_dir = NULL
)
Arguments
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 |
Value
A tibble containing the data.
INKAR Indicators Metadata
Description
A comprehensive list of available indicators from the INKAR database. This dataset is used to lookup indicator IDs, names, and descriptions.
Usage
indicators
Format
A data frame with the following columns:
- ID
Short identifier (e.g., "001")
- M_ID
Numeric internal ID used by API
- Name_DE
German name of the indicator
- Name_EN
English name (translated or placeholder)
- Description_DE
Detailed German description
- Theme
Group/Domain of the indicator
- Active
Logical. TRUE if verified as active in the API
- Algorithmus
Algorithm used (if any)
- Anmerkungen
Notes in German
- Anmerkungen_EN
Notes in English
- Gemeinden
Availability for Municipalities
- Kreise
Availability for Districts
- Statistische Grundlagen
Statistical basis (DE)
- Stat_Grund_EN
Statistical basis (EN)
- Unit_DE
Unit of measurement (DE)
- Unit_EN
Unit of measurement (EN)
Source
Download Data from INKAR (Alias)
Description
A convenient alias for get_inkar_data(). Call inkaR("011") to download
directly, or call inkaR() with no arguments in an interactive session to
open a searchable menu.
Usage
inkaR(variable = NULL, level = NULL, ...)
Arguments
variable |
Character. Indicator ID, shortname, or partial name.
If |
level |
Character. Spatial level code (e.g., |
... |
Additional arguments passed to |
Value
A tibble containing the downloaded data, or NULL if selection was cancelled.
Examples
if (interactive()) {
df <- inkaR() # opens interactive menu
}
df <- inkaR("bip", level = "KRE", year = 2021)
df <- inkaR("Bruttoinlandsprodukt", level = "KRE")
Plot INKAR Data on German Maps
Description
Automatically projects regional INKAR data onto administrative boundaries of Germany using
the geodata and sf packages. Supports Kreise (KRE) and Bundesländer (BLD) levels.
Usage
plot_inkar(data, year = NULL)
Arguments
data |
A data frame returned by |
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. |
Value
A ggplot2 object displaying the mapped data.
Search Indicators and Print Results
Description
Search for indicators by keyword. Prints a formatted table and invisibly
returns the matches so you can copy the ID for use in inkaR().
Usage
search_indicators(pattern, lang = c("de", "en"))
Arguments
pattern |
Text to search in names and descriptions. |
lang |
Language to search in ("de" or "en"). |
Value
A filtered tibble of indicators (invisibly).
Interactively Select an Indicator
Description
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.
Usage
select_indicator(pattern = NULL, lang = c("de", "en"))
Arguments
pattern |
Optional character. Pre-filter the list by a keyword or regex.
If |
lang |
Language for names: |
Value
Character. The selected indicator ID, or NULL if cancelled.
Interactively Select a Spatial Level
Description
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.
Usage
select_level(variable = NULL)
Arguments
variable |
Optional character. The indicator ID to probe available levels. |
Value
Character. The selected level ID, e.g., "KRE".
View Indicators in RStudio Viewer
Description
Opens the available indicators in the RStudio data viewer for easy filtering and searching.
Usage
view_indicators(lang = c("de", "en"))
Arguments
lang |
Language code: "de" (German) or "en" (English). |
Value
Invokes View() on the data frame.