fedstat_parse_sdmx_to_table: Parse sdmx raw bytes to data.frame

View source: R/fedstat_parse_sdmx_to_table.R

fedstat_parse_sdmx_to_tableR Documentation

Parse sdmx raw bytes to data.frame

Description

For advanced use. Most downloads should use fedstat_download(), which splits large selections, pauses between requests and saves progress.

Parses sdmx raw bytes received in response to POST request. This function is a wrapper around readsdmx::read_sdmx, in addition to reading data, automatically adds columns with values from lookup tables. Can also return full data codes dictionary for the indicator

Usage

fedstat_parse_sdmx_to_table(
  data_raw,
  return_type = c("data", "dictionary"),
  try_to_parse_ObsValue = TRUE
)

Arguments

data_raw

sdmx raw bytes or a path to an existing SDMX XML file

return_type

character, "data" or "dictionary", data for actual data, dictionary for sdmx lookup table (full data codes dictionary). fedstat_dictionary() gets the dictionary without choosing filters.

try_to_parse_ObsValue

logical, try to parse ObsValue column from character to R numeric type

Value

data.frame

See Also

fedstat_parse_sdmx_to_table

Examples

## Not run: 
# Get data filters identificators for CPI
# filter the data_ids to get data for january of 2023
# for all goods and services for Russian Federation
# POST filters and download data in sdmx format
# Parse raw sdmx to data.frame
data <- fedstat_get_data_ids("31074") %>%
    fedstat_data_ids_filter(
        filters = list(
            "Territory" = "Russian Federation",
            "Year" = "2023",
            "Period" = "January",
            "Types of goods and services" = "*"
        )
    ) %>%
    fedstat_post_data_ids_filtered() %>%
    fedstat_parse_sdmx_to_table()

# Not actual filter field titles and filter values titles because of ASCII requirement for CRAN

## End(Not run)

fedstatAPIr documentation built on Nov. 4, 2026, 9:07 a.m.