get_values {rKolada} | R Documentation |
Get data from Kolada
Description
Download a table of data from Kolada. Data is selected based on three metadata dimensions: KPI (ID), municipality (ID) and period (years). You must supply arguments for at least two of these three dimensions. If a dimension is omitted, all available data for that dimension will be downloaded.
Usage
get_values(
kpi = NULL,
municipality = NULL,
period = NULL,
ou = NULL,
unit_type = "municipality",
max_results = NULL,
simplify = TRUE,
verbose = FALSE
)
Arguments
kpi |
What kpis should be fetched? Can be a single name or a vector of names. |
municipality |
For which municipalities should data be fetched? Can be a single name or a vector of names. |
period |
For what years should data be fetched? Can be one or more four-digit integers or character strings. |
ou |
(Optional) for what Operating Units should data be fetched? Only available for certain KPIs. |
unit_type |
One of |
max_results |
(Optional) Specify the maximum number of results returned by the query. |
simplify |
Whether to make results more human readable. |
verbose |
Whether to print the call to the Kolada API as a message to the R console. |
Value
A tibble containing Kolada values and metadata.
Examples
# Download data for KPIs for Gross Regional Product ("BRP" in Swedish)
# for three municipalities
if (kolada_available()) {
# If you already know the ID numbers you are looking for,
# you can use these directly as argments.
# Otherwise, use the get_\*() functions in combination with \*_search()
# functions to find good parameter values.
grp_data <- get_values(
kpi = c("N03700", "N03701"),
municipality = c("0180", "1480", "1280")
)
# To download OU data instead of Municipality data, set the parameter
# "unit_type" to "ou".
ou_data <- get_values(
kpi = "N15033",
ou = "V15E144001101",
unit_type = "ou"
)
}