| Title: | Obtaining Data Published by the National Statistics Institute |
|---|---|
| Description: | Get open statistical data and metadata disseminated by the National Statistics Institute of Spain (INE). The functions return data frames with the requested information thanks to calls to the 'INE' API <https://www.ine.es/dyngs/DAB/index.htm?cid=1100>. |
| Authors: | David Crespo [aut, cre], National Statistics Institute, INE [cph] |
| Maintainer: | David Crespo <[email protected]> |
| License: | EUPL (== 1.2) |
| Version: | 0.2.5 |
| Built: | 2026-05-18 10:01:29 UTC |
| Source: | https://github.com/es-ine/ineapir |
Retrieve data from series published by INE calling the API
get_data_series( codSeries = NULL, nlast = 1, dateStart = NULL, dateEnd = NULL, det = 0, tip = NULL, lang = "ES", validate = TRUE, verbose = FALSE, unnest = FALSE )get_data_series( codSeries = NULL, nlast = 1, dateStart = NULL, dateEnd = NULL, det = 0, tip = NULL, lang = "ES", validate = TRUE, verbose = FALSE, unnest = FALSE )
codSeries |
(string): Code of the series. For further information about codes click this link. |
nlast |
(int): number of periods to retrieve. By default is set to 1 period. |
dateStart |
(string): the initial date of the requested data. The required format is yyyy/mm/dd. Additionally, dateStart can be a vector of dates, where each date represents the start date of individual ranges where the end date should be found at the same position in the dateEnd vector. If dateStart and dateEnd are equal, the specified dates are retrieved. If no end date is entered, all dates will be queried, from the corresponding start date to the last available period. |
dateEnd |
(string): the end date of the requested data. The required format is yyyy/mm/dd. Additionally, dateEnd can be a vector of dates, where each date represents the end date of individual ranges where the initial date should be found at the same position in the dateStart vector. The length of the dateEnd vector must be less than or equal to the length of the dateStart vector. |
det |
(int): level of detail. Valid values: 0, 1 or 2. |
tip |
(string): set to 'A' for friendly output (e.g. readable dates), set to 'M' to include metadata or set to 'AM' for both. |
lang |
(string): language of the retrieved data. Set to 'ES' for Spanish or set to 'EN' for English. |
validate |
(logical): validate input parameters. |
verbose |
(logical): print additional information, including the URL to call the API service. |
unnest |
(logical): set to TRUE to obtain a single data frame of data |
Data frame with data of a series according to the code specified in the function
df <- get_data_series(codSeries = "IPC251856", nlast = 5) head(df) # Get data for an open range date df <- get_data_series(codSeries = "IPC251856", dateStart = "2024/01/01") head(df) # Get data for a single range data df <- get_data_series(codSeries = "IPC251856", dateStart = "2023/01/01", dateEnd = "2023/05/01") head(df) # Get data for specific dates df <- get_data_series(codSeries = "IPC251856", dateStart = c("2023/01/01","2024/01/01"), dateEnd = c("2023/01/01","2024/01/01")) head(df) # Get data for multiple date ranges df <- get_data_series(codSeries = "IPC251856", dateStart = c("2023/01/01","2024/01/01"), dateEnd = c("2023/03/01","2024/03/01")) head(df)df <- get_data_series(codSeries = "IPC251856", nlast = 5) head(df) # Get data for an open range date df <- get_data_series(codSeries = "IPC251856", dateStart = "2024/01/01") head(df) # Get data for a single range data df <- get_data_series(codSeries = "IPC251856", dateStart = "2023/01/01", dateEnd = "2023/05/01") head(df) # Get data for specific dates df <- get_data_series(codSeries = "IPC251856", dateStart = c("2023/01/01","2024/01/01"), dateEnd = c("2023/01/01","2024/01/01")) head(df) # Get data for multiple date ranges df <- get_data_series(codSeries = "IPC251856", dateStart = c("2023/01/01","2024/01/01"), dateEnd = c("2023/03/01","2024/03/01")) head(df)
Get data from series for a specific operation given a filter
get_data_series_filter( operation = NULL, filter = NULL, periodicity = NULL, nlast = 1, dateStart = NULL, dateEnd = NULL, det = 0, tip = NULL, lang = "ES", page = 1, validate = TRUE, verbose = FALSE, unnest = FALSE )get_data_series_filter( operation = NULL, filter = NULL, periodicity = NULL, nlast = 1, dateStart = NULL, dateEnd = NULL, det = 0, tip = NULL, lang = "ES", page = 1, validate = TRUE, verbose = FALSE, unnest = FALSE )
operation |
(string): Code of the operation. To obtain a list of
available operations see |
filter |
(list): list of variables and values. Filtering data from seriesWhen we request data from series there is the possibility of filtering data
on the fly using metadata information about the variables and their values
that define the series. To get variables for a given operation see
Filter formatThe format is
Using shortcutsAdditionally, shortcuts can be used to filter. They simplify the filtering
approach by using standardized names for variable IDs and therefore simplify
their use. The format is:
|
periodicity |
(int): id of the periodicity of the series. Common periodicities:
1 (monthly), 3 (quarterly), 6 (bi-annual), 12 (annual). To obtain a list
of periodicities see |
nlast |
(int): number of periods to retrieve. By default is set to 1 period. |
dateStart |
(string): the initial date of the requested data. The required format is yyyy/mm/dd. Additionally, dateStart can be a vector of dates, where each date represents the start date of individual ranges where the end date should be found at the same position in the dateEnd vector. If dateStart and dateEnd are equal, the specified dates are retrieved. If no end date is entered, all dates will be queried, from the corresponding start date to the last available period. |
dateEnd |
(string): the end date of the requested data. The required format is yyyy/mm/dd. Additionally, dateEnd can be a vector of dates, where each date represents the end date of individual ranges where the initial date should be found at the same position in the dateStart vector. The length of the dateEnd vector must be less than or equal to the length of the dateStart vector. |
det |
(int): level of detail. Valid values: 0, 1 or 2. |
tip |
(string): set to 'A' for friendly output (e.g. readable dates), set to 'M' to include metadata or set to 'AM' for both. |
lang |
(string): language of the retrieved data. Set to 'ES' for Spanish or set to 'EN' for English. |
page |
(int): page number. The retrieved result of the query is paginated. Default value is set to 1. |
validate |
(logical): validate the input parameters. A FALSE value means fewer API calls. Therefore, it is recommended to set it to FALSE when there is no doubt about the validity of the input parameters, including the filter. |
verbose |
(logical): print additional information, including the URL to call the API service. |
unnest |
(logical): obtain a single data frame of data |
Data frame with data of series according to the operation and filter specified in the function
# Get last five periods and filter data of time series from "IPC" operation filter <- list("115"= "28", "3" = "84", "762" = "304092") df <- get_data_series_filter(operation = "IPC", periodicity = 1, nlast = 5, unnest = TRUE, validate = FALSE, filter = filter) head(df)# Get last five periods and filter data of time series from "IPC" operation filter <- list("115"= "28", "3" = "84", "762" = "304092") df <- get_data_series_filter(operation = "IPC", periodicity = 1, nlast = 5, unnest = TRUE, validate = FALSE, filter = filter) head(df)
Get data from a specific table
get_data_table( idTable = NULL, filter = NULL, nlast = NULL, dateStart = NULL, dateEnd = NULL, det = 0, tip = NULL, lang = "ES", validate = TRUE, verbose = FALSE, unnest = FALSE, metanames = FALSE, metacodes = FALSE )get_data_table( idTable = NULL, filter = NULL, nlast = NULL, dateStart = NULL, dateEnd = NULL, det = 0, tip = NULL, lang = "ES", validate = TRUE, verbose = FALSE, unnest = FALSE, metanames = FALSE, metacodes = FALSE )
idTable |
(int): id of the table. For further information about ids click this link. |
filter |
(list): list of variables and values. Filtering data from tablesWhen we request data from tables there is the possibility of filtering data
on the fly using metadata information about the variables and their values
that define the series. See Case one: tempus tableURL example.
For a tempus table the filter is based on ids. The format is
Case two: px tablesURL example.
For a px table the filter is based on codes. The format is
Case three: tpx tableURL example.
For a tpx table the filter is based on codes. The format is
URL example.
There are tpx tables that contain variable ids and value ids. In this case,
we can use the ids instead of the codes to build the filter. To do this we add
the alias ~id at the end of each id: Using shortcutsAdditionally, shortcuts can be used to filter. They simplify the filtering
approach by using standardized names for variable IDs and therefore simplify
their use. The format for a tempus table is:
|
nlast |
(int): number of periods to retrieve. By default it retrieves all available periods. |
dateStart |
(string): the initial date of the requested data. The required format is yyyy/mm/dd. Additionally, dateStart can be a vector of dates, where each date represents the start date of individual ranges where the end date should be found at the same position in the dateEnd vector. If dateStart and dateEnd are equal, the specified dates are retrieved. If no end date is entered, all dates will be queried, from the corresponding start date to the last available period. |
dateEnd |
(string): the end date of the requested data. The required format is yyyy/mm/dd. Additionally, dateEnd can be a vector of dates, where each date represents the end date of individual ranges where the initial date should be found at the same position in the dateStart vector. The length of the dateEnd vector must be less than or equal to the length of the dateStart vector. |
det |
(int): level of detail. Valid values: 0, 1 or 2. |
tip |
(string): set to 'A' for friendly output (e.g. readable dates), set to 'M' to include metadata or set to 'AM' for both. |
lang |
(string): language of the retrieved data. Set to 'ES' for Spanish or set to 'EN' for English. |
validate |
(logical): validate the input parameters. A FALSE value means fewer API calls. Therefore, it is recommended to set it to FALSE when there is no doubt about the validity of the input parameters, including the filter. |
verbose |
(logical): print additional information, including the URL to call the API service. |
unnest |
(logical): set to TRUE to obtain a single data frame of data. |
metanames |
(logical): set to TRUE to extract the name of the values that defined the table. The names are extracted from the metadata information (it is mandatory to include 'M' in the tip parameter). Several columns are created corresponding to the values of the different variables. |
metacodes |
(logical): set to TRUE to extract the codes and ids of the values that defined the table. The codes and ids are extracted from the metadata information (it is mandatory to include 'M' in the tip parameter). Several columns are created corresponding to the values of the different variables. |
Data frame with data of a table according to the id specified in the function
# Obtaining the last two periods and filter data filter <- list("3" = "74", "762" = "304092") df <-get_data_table(idTable = 50902, nlast = 2, unnest = TRUE, filter = filter, validate = FALSE) head(df) # Get data for an open range date df <- get_data_table(idTable = 50902, unnest = TRUE, tip= "A", filter = filter, validate = FALSE, dateStart = "2025/01/01") head(df) # Get data for a single range data df <- get_data_table(idTable = 50902, unnest = TRUE, tip= "A", filter = filter, validate = FALSE, dateStart = "2023/01/01", dateEnd = "2023/05/01") head(df) # Get data for specific dates df <- get_data_table(idTable = 50902, unnest = TRUE, tip= "A", filter = filter, validate = FALSE, dateStart = c("2023/01/01","2024/01/01"), dateEnd = c("2023/01/01","2024/01/01")) head(df) # Get data for multiple date ranges df <- get_data_table(idTable = 50902, unnest = TRUE, tip= "A", filter = filter, validate = FALSE, dateStart = c("2023/01/01","2024/01/01"), dateEnd = c("2023/03/01","2024/03/01")) head(df) # Get medatada as well df <- get_data_table(idTable = 50902, nlast = 2, unnest = TRUE, filter = filter, validate = FALSE, metanames = TRUE, metacodes = TRUE, tip = "M") head(df)# Obtaining the last two periods and filter data filter <- list("3" = "74", "762" = "304092") df <-get_data_table(idTable = 50902, nlast = 2, unnest = TRUE, filter = filter, validate = FALSE) head(df) # Get data for an open range date df <- get_data_table(idTable = 50902, unnest = TRUE, tip= "A", filter = filter, validate = FALSE, dateStart = "2025/01/01") head(df) # Get data for a single range data df <- get_data_table(idTable = 50902, unnest = TRUE, tip= "A", filter = filter, validate = FALSE, dateStart = "2023/01/01", dateEnd = "2023/05/01") head(df) # Get data for specific dates df <- get_data_table(idTable = 50902, unnest = TRUE, tip= "A", filter = filter, validate = FALSE, dateStart = c("2023/01/01","2024/01/01"), dateEnd = c("2023/01/01","2024/01/01")) head(df) # Get data for multiple date ranges df <- get_data_table(idTable = 50902, unnest = TRUE, tip= "A", filter = filter, validate = FALSE, dateStart = c("2023/01/01","2024/01/01"), dateEnd = c("2023/03/01","2024/03/01")) head(df) # Get medatada as well df <- get_data_table(idTable = 50902, nlast = 2, unnest = TRUE, filter = filter, validate = FALSE, metanames = TRUE, metacodes = TRUE, tip = "M") head(df)
Get all available filter shortcuts
get_filter_shortcuts(lang = "ES", validate = TRUE, verbose = FALSE)get_filter_shortcuts(lang = "ES", validate = TRUE, verbose = FALSE)
lang |
(string): language. Set to 'ES' for the Spanish version of the shortcuts or set to 'EN' for the English version of the shortcuts. |
validate |
(logical): validate input parameters. |
verbose |
(logical): print additional information. |
Data frame with information of the available filter shortcuts
# Shortcuts in spanish df <- get_filter_shortcuts() head(df) # Shortcuts in english df <- get_filter_shortcuts(lang = "EN") head(df)# Shortcuts in spanish df <- get_filter_shortcuts() head(df) # Shortcuts in english df <- get_filter_shortcuts(lang = "EN") head(df)
Get all available classifications
get_metadata_classifications( operation = NULL, lang = "ES", validate = TRUE, verbose = FALSE )get_metadata_classifications( operation = NULL, lang = "ES", validate = TRUE, verbose = FALSE )
operation |
(string): Code of the operation. Provide code to get all
the classifications for the given operation. To obtain a list of
available operations see |
lang |
(string): language of the retrieved data. Set to 'ES' for Spanish or set to 'EN' for English. |
validate |
(logical): validate input parameters. A FALSE value means fewer API calls. |
verbose |
(logical): print additional information, including the URL to call the API service. |
Data frame with information of the available classifications
# Get all classifications df <- get_metadata_classifications() head(df) # Get classifications for a specific operation df <- get_metadata_classifications(operation = "IPC", validate = FALSE) head(df)# Get all classifications df <- get_metadata_classifications() head(df) # Get classifications for a specific operation df <- get_metadata_classifications(operation = "IPC", validate = FALSE) head(df)
Get the operation for a given table
get_metadata_operation_table( idTable = NULL, lang = "ES", validate = TRUE, verbose = FALSE )get_metadata_operation_table( idTable = NULL, lang = "ES", validate = TRUE, verbose = FALSE )
idTable |
(int): id of the table. For further information about ids click this link. |
lang |
(string): language of the retrieved data. Set to 'ES' for Spanish or set to 'EN' for English. |
validate |
(logical): validate input parameters. |
verbose |
(logical): print additional information, including the URL to call the API service. |
Data frame with information of the operation according to the table specified in the function
# Get the operation of the table with identification code "50902" df <- get_metadata_operation_table(idTable = 50902) head(df)# Get the operation of the table with identification code "50902" df <- get_metadata_operation_table(idTable = 50902) head(df)
Get all available operations
get_metadata_operations( operation = NULL, lang = "ES", geo = NULL, page = 0, validate = TRUE, verbose = FALSE )get_metadata_operations( operation = NULL, lang = "ES", geo = NULL, page = 0, validate = TRUE, verbose = FALSE )
operation |
(string): code of the operation. To obtain a list of
available operations see |
lang |
(string): language of the retrieved data. Set to 'ES' for Spanish or set to 'EN' for English. |
geo |
(int): set to 0 for operations with national data or set to 1 for operations with data with a greater level of disaggregation. |
page |
(int): page number. The retrieved result of the query is paginated (page=0 retrieves all pages). |
validate |
(logical): validate input parameters. A FALSE value means fewer API calls. |
verbose |
(logical): print additional information, including the URL to call the API service. |
Data frame with information of the available operations
# Get all operations df <- get_metadata_operations() head(df) # Get a specific operation df <- get_metadata_operations(operation = "IPC", validate = FALSE) head(df) # Get operations with territorial disaggregation df <- get_metadata_operations(geo = 1) head(df)# Get all operations df <- get_metadata_operations() head(df) # Get a specific operation df <- get_metadata_operations(operation = "IPC", validate = FALSE) head(df) # Get operations with territorial disaggregation df <- get_metadata_operations(geo = 1) head(df)
Get all available periodicities
get_metadata_periodicity( operation = NULL, lang = "ES", validate = TRUE, verbose = FALSE )get_metadata_periodicity( operation = NULL, lang = "ES", validate = TRUE, verbose = FALSE )
operation |
(string): Code of the operation. Provide code to get all
the periodicities for the given operation. To obtain a list of
available operations see |
lang |
(string): language of the retrieved data. Set to 'ES' for Spanish or set to 'EN' for English. |
validate |
(logical): validate input parameters. A FALSE value means fewer API calls. |
verbose |
(logical): print additional information, including the URL to call the API service. |
Data frame with information of the available periodicities
# Get all periodicities df <- get_metadata_periodicity() head(df) # Get periodicities for a specific operation df <- get_metadata_periodicity(operation = "IPC", validate = FALSE) head(df)# Get all periodicities df <- get_metadata_periodicity() head(df) # Get periodicities for a specific operation df <- get_metadata_periodicity(operation = "IPC", validate = FALSE) head(df)
Get the dates of a publication
get_metadata_publication_dates( publication = NULL, det = 0, tip = NULL, lang = "ES", page = 0, validate = TRUE, verbose = FALSE )get_metadata_publication_dates( publication = NULL, det = 0, tip = NULL, lang = "ES", page = 0, validate = TRUE, verbose = FALSE )
publication |
(int): id of the publication. To obtain a list of
available publications see |
det |
(int): level of detail. Valid values: 0, 1 or 2. |
tip |
(string): set to 'A' for friendly output (e.g. readable dates), set to 'M' to include metadata or set to 'AM' for both. |
lang |
(string): language of the retrieved data. Set to 'ES' for Spanish or set to 'EN' for English. |
page |
(int): page number. The retrieved result of the query is paginated (page=0 retrieves all pages). |
validate |
(logical): validate input parameters. A FALSE value means fewer API calls. |
verbose |
(logical): print additional information, including the URL to call the API service. |
Data frame with information of the dates of the publication specified in the function
# Get the dates of a publication df <- get_metadata_publication_dates(publication = 8, validate = FALSE) head(df)# Get the dates of a publication df <- get_metadata_publication_dates(publication = 8, validate = FALSE) head(df)
Get all publications
get_metadata_publications( operation = NULL, det = 0, lang = "ES", page = 0, validate = TRUE, verbose = FALSE )get_metadata_publications( operation = NULL, det = 0, lang = "ES", page = 0, validate = TRUE, verbose = FALSE )
operation |
(string): code of the operation. Provide code to get all
the publications for the given operation. To obtain a list of
available operations see |
det |
(int): level of detail. Valid values: 0, 1 or 2. |
lang |
(string): language of the retrieved data. Set to 'ES' for Spanish or set to 'EN' for English. |
page |
(int): page number. The retrieved result of the query is paginated (page=0 retrieves all pages). |
validate |
(logical): validate input parameters. A FALSE value means fewer API calls. |
verbose |
(logical): print additional information, including the URL to call the API service. |
Data frame with information about publications
# Get all publications df <- get_metadata_publications() head(df) # Get publications for a specific operation df <- get_metadata_publications(operation = "IPC", validate = FALSE) head(df)# Get all publications df <- get_metadata_publications() head(df) # Get publications for a specific operation df <- get_metadata_publications(operation = "IPC", validate = FALSE) head(df)
Get information for a specific series
get_metadata_series( codSeries = NULL, det = 0, tip = NULL, lang = "ES", validate = TRUE, verbose = FALSE )get_metadata_series( codSeries = NULL, det = 0, tip = NULL, lang = "ES", validate = TRUE, verbose = FALSE )
codSeries |
(string): code of the series. For further information about codes click this link. |
det |
(int): level of detail. Valid values: 0, 1 or 2. |
tip |
(string): set to 'A' for friendly output (e.g. readable dates), set to 'M' to include metadata or set to 'AM' for both. |
lang |
(string): language of the retrieved data. Set to 'ES' for Spanish or set to 'EN' for English. |
validate |
(logical): validate input parameters. |
verbose |
(logical): print additional information, including the URL to call the API service. |
Data frame with information of a series according to the code specified in the function
# Get information of time series with code "IPC206449" df <- get_metadata_series(codSeries = "IPC206449") head(df)# Get information of time series with code "IPC206449" df <- get_metadata_series(codSeries = "IPC206449") head(df)
Get all the series for a specific operation given a filter
get_metadata_series_filter( operation = NULL, filter = NULL, periodicity = NULL, det = 0, tip = NULL, lang = "ES", page = 1, validate = TRUE, verbose = FALSE )get_metadata_series_filter( operation = NULL, filter = NULL, periodicity = NULL, det = 0, tip = NULL, lang = "ES", page = 1, validate = TRUE, verbose = FALSE )
operation |
(string): code of the operation. To obtain a list of
available operations see |
filter |
(list): list of variables and values. Filtering data from seriesWhen we request data from series there is the possibility of filtering data
on the fly using metadata information about the variables and their values
that define the series. To get variables for a given operation see
Filter formatThe format is
Using shortcutsAdditionally, shortcuts can be used to filter. They simplify the filtering
approach by using standardized names for variable IDs and therefore simplify
their use. The format is:
|
periodicity |
(int): id of the periodicity of the series. Common periodicities:
1 (monthly), 3 (quarterly), 6 (bi-annual), 12 (annual). To obtain a list
of periodicities see |
det |
(int): level of detail. Valid values: 0, 1 or 2. |
tip |
(string): set to 'A' for friendly output (e.g. readable dates), set to 'M' to include metadata or set to 'AM' for both. |
lang |
(string): language of the retrieved data. Set to 'ES' for Spanish or set to 'EN' for English. |
page |
(int): page number. The retrieved result of the query is paginated. Default value is set to 1. |
validate |
(logical): validate input parameters. A FALSE value means fewer API calls. Therefore, it is recommended to set it to FALSE when there is no doubt about the validity of the input parameters, including the filter. |
verbose |
(logical): print additional information, including the URL to call the API service. |
Data frame with information of the series according to the operation and filter specified in the function
# Get time series from "IPC" operation that include the filter variables # and values df <- get_metadata_series_filter(operation = "IPC", periodicity = 1, filter = list("115"= "29", "3" = "84", "762" = ""), validate = FALSE) head(df)# Get time series from "IPC" operation that include the filter variables # and values df <- get_metadata_series_filter(operation = "IPC", periodicity = 1, filter = list("115"= "29", "3" = "84", "762" = ""), validate = FALSE) head(df)
Get all the series for a specific operation
get_metadata_series_operation( operation = NULL, det = 0, tip = NULL, lang = "ES", page = 1, validate = TRUE, verbose = FALSE )get_metadata_series_operation( operation = NULL, det = 0, tip = NULL, lang = "ES", page = 1, validate = TRUE, verbose = FALSE )
operation |
(string): code of the operation. To obtain a list of
available operations see |
det |
(int): level of detail. Valid values: 0, 1 or 2. |
tip |
(string): set to 'A' for friendly output (e.g. readable dates), set to 'M' to include metadata or set to 'AM' for both. |
lang |
(string): language of the retrieved data. Set to 'ES' for Spanish or set to 'EN' for English. |
page |
(int): page number. The retrieved result of the query is paginated. Default value is set to 1. |
validate |
(logical): validate input parameters. A FALSE value means fewer API calls. |
verbose |
(logical): print additional information, including the URL to call the API service. |
Data frame with information of the series belonging to an operation.
# Get metadata of time series from "IPC" operation # Retrieve page 1 df <- get_metadata_series_operation(operation = "IPC", validate = FALSE) nrow(df) # Retrieve page 2 df <- get_metadata_series_operation(operation = "IPC", validate = FALSE, page = 2) nrow(df)# Get metadata of time series from "IPC" operation # Retrieve page 1 df <- get_metadata_series_operation(operation = "IPC", validate = FALSE) nrow(df) # Retrieve page 2 df <- get_metadata_series_operation(operation = "IPC", validate = FALSE, page = 2) nrow(df)
Get all the series for a given table
get_metadata_series_table( idTable = NULL, filter = NULL, det = 0, tip = NULL, lang = "ES", validate = TRUE, verbose = FALSE, metanames = FALSE, metacodes = FALSE )get_metadata_series_table( idTable = NULL, filter = NULL, det = 0, tip = NULL, lang = "ES", validate = TRUE, verbose = FALSE, metanames = FALSE, metacodes = FALSE )
idTable |
(int): id of the table. For further information about ids click this link. |
filter |
(list): list of variables and values. Filtering data from tablesWhen we request data from tables there is the possibility of filtering data
on the fly using metadata information about the variables and their values
that define the series. See Case one: tempus tableURL example.
For a tempus table the filter is based on ids. The format is
Case two: px tablesURL example.
For a px table the filter is based on codes. The format is
Case three: tpx tableURL example.
For a tpx table the filter is based on codes. The format is
URL example.
There are tpx tables that contain variable ids and value ids. In this case,
we can use the ids instead of the codes to build the filter. To do this we add
the alias ~id at the end of each id: Using shortcutsAdditionally, shortcuts can be used to filter. They simplify the filtering
approach by using standardized names for variable IDs and therefore simplify
their use. The format for a tempus table is:
|
det |
(int): level of detail. Valid values: 0, 1 or 2. |
tip |
(string): set to 'A' for friendly output (e.g. readable dates), set to 'M' to include metadata or set to 'AM' for both. |
lang |
(string): language of the retrieved data. Set to 'ES' for Spanish or set to 'EN' for English. |
validate |
(logical): validate input parameters. A FALSE value means fewer API calls. Therefore, it is recommended to set it to FALSE when there is no doubt about the validity of the input parameters, including the filter. |
verbose |
(logical): print additional information, including the URL to call the API service. |
metanames |
(logical): set to TRUE to extract the name of the values that defined the table. The names are extracted from the metadata information (it is mandatory to include 'M' in the tip parameter). Several columns are created corresponding to the values of the different variables. |
metacodes |
(logical): set to TRUE to extract the codes and ids of the values that defined the table. The codes and ids are extracted from the metadata information (it is mandatory to include 'M' in the tip parameter). Several columns are created corresponding to the values of the different variables. |
Data frame with information of the series for a given table.
# Get time series without data from table with identification code "50902" filter <- list("3" = "83") df <- get_metadata_series_table(idTable = 50902, validate = FALSE, filter = filter) head(df) # Get metadata as well df <- get_metadata_series_table(idTable = 50902, validate = FALSE, filter = filter, metanames = TRUE, metacodes = TRUE, tip = "M") head(df)# Get time series without data from table with identification code "50902" filter <- list("3" = "83") df <- get_metadata_series_table(idTable = 50902, validate = FALSE, filter = filter) head(df) # Get metadata as well df <- get_metadata_series_table(idTable = 50902, validate = FALSE, filter = filter, metanames = TRUE, metacodes = TRUE, tip = "M") head(df)
Get all the values for a given series
get_metadata_series_values( codSeries = NULL, det = 0, tip = NULL, lang = "ES", validate = TRUE, verbose = FALSE )get_metadata_series_values( codSeries = NULL, det = 0, tip = NULL, lang = "ES", validate = TRUE, verbose = FALSE )
codSeries |
(string): code of the series. For further information about codes click this link. |
det |
(int): level of detail. Valid values: 0, 1 or 2. |
tip |
(string): set to 'A' for friendly output (e.g. readable dates), set to 'M' to include metadata or set to 'AM' for both. |
lang |
(string): language of the retrieved data. Set to 'ES' for Spanish or set to 'EN' for English. |
validate |
(logical): validate input parameters. |
verbose |
(logical): print additional information, including the URL to call the API service. |
Data frame with information of the values of a series according to the code specified in the function
# Get metadata of time series with code "IPC206449" df <- get_metadata_series_values(codSeries = "IPC206449") head(df)# Get metadata of time series with code "IPC206449" df <- get_metadata_series_values(codSeries = "IPC206449") head(df)
Get metadata information about the variables and values of series for a given operation
get_metadata_series_varval( operation = NULL, lang = "ES", det = 0, validate = TRUE, verbose = FALSE )get_metadata_series_varval( operation = NULL, lang = "ES", det = 0, validate = TRUE, verbose = FALSE )
operation |
(string): code of the operation. To obtain a list of
available operations see |
lang |
(string): language of the retrieved data. Set to 'ES' for Spanish or set to 'EN' for English. |
det |
(int): level of detail. Valid values: 0, 1 or 2. |
validate |
(logical): validate input parameters. A FALSE value means fewer API calls. |
verbose |
(logical): print additional information, including the URL to call the API service. |
Data frame with information about the variables and values that define the series according to the operation specified in the function
# Get metadata information of time series from "IPC" operation df <- get_metadata_series_varval(operation = "IPC", validate = FALSE) head(df)# Get metadata information of time series from "IPC" operation df <- get_metadata_series_varval(operation = "IPC", validate = FALSE) head(df)
Get all groups for a specific a table
get_metadata_table_groups( idTable = NULL, lang = "ES", validate = TRUE, verbose = FALSE )get_metadata_table_groups( idTable = NULL, lang = "ES", validate = TRUE, verbose = FALSE )
idTable |
(int): id of the table. For further information about ids click this link. |
lang |
(string): language of the retrieved data. Set to 'ES' for Spanish or set to 'EN' for English. |
validate |
(logical): validate input parameters. |
verbose |
(logical): print additional information, including the URL to call the API service. |
Data frame with information of the groups according to the table specified in the function
# Get the groups of the table with identification code "50902" df <- get_metadata_table_groups(idTable = 50902) head(df)# Get the groups of the table with identification code "50902" df <- get_metadata_table_groups(idTable = 50902) head(df)
Get all values for a specific table group
get_metadata_table_values( idTable = NULL, idGroup = NULL, det = 0, lang = "ES", validate = TRUE, verbose = FALSE )get_metadata_table_values( idTable = NULL, idGroup = NULL, det = 0, lang = "ES", validate = TRUE, verbose = FALSE )
idTable |
(int): id of the table. For further information about ids click this link. |
idGroup |
(int): id of the group of variables. To get all groups
for a specific table see |
det |
(int): level of detail. Valid values: 0, 1 or 2. |
lang |
(string): language of the retrieved data. Set to 'ES' for Spanish or set to 'EN' for English. |
validate |
(logical): validate input parameters. A FALSE value means fewer API calls. |
verbose |
(logical): print additional information, including the URL to call the API service. |
Data frame with information of the values of a table group according to the table and group specified in the function
# Get the values of the group "110889" of the table with identification # code "50902" df <- get_metadata_table_values(idTable = 50902, idGroup = 110889, validate = FALSE) head(df)# Get the values of the group "110889" of the table with identification # code "50902" df <- get_metadata_table_values(idTable = 50902, idGroup = 110889, validate = FALSE) head(df)
Get metadata information about the variables and values for a given table
get_metadata_table_varval( idTable = NULL, det = 0, filter = NULL, lang = "ES", validate = TRUE, verbose = FALSE )get_metadata_table_varval( idTable = NULL, det = 0, filter = NULL, lang = "ES", validate = TRUE, verbose = FALSE )
idTable |
(int): id of the table. For further information about ids click this link. |
det |
(int): level of detail. Valid values: 0, 1 or 2. |
filter |
(list): list of variables and values. Filtering data from tablesWhen we request data from tables there is the possibility of filtering data on the fly using metadata information about the variables and their values that define the series. There are different approaches to build the filter depending on the table type. Case one: tempus tableURL example.
For a tempus table the filter is based on ids. The format is
Case two: px tablesURL example.
For a px table the filter is based on codes. The format is
Case three: tpx tableURL example.
For a tpx table the filter is based on codes. The format is
URL example.
There are tpx tables that contain variable ids and value ids. In this case,
we can use the ids instead of the codes to build the filter. To do this we add
the alias ~id at the end of each id: |
lang |
(string): language of the retrieved data. Set to 'ES' for Spanish or set to 'EN' for English. |
validate |
(logical): validate input parameters.A FALSE value means fewer API calls. Therefore, it is recommended to set it to FALSE when there is no doubt about the validity of the input parameters, including the filter. |
verbose |
(logical): print additional information, including the URL to call the API service. |
Data frame with information about the variables and values that define a table according to the table specified in the function
# Get all the variable and values of the table with identification code "50902" df <- get_metadata_table_varval(idTable = 50902) head(df) # Filter variables and values df <- get_metadata_table_varval(idTable = 52056, filter = list(NAC = "00"), validate = FALSE) head(df)# Get all the variable and values of the table with identification code "50902" df <- get_metadata_table_varval(idTable = 50902) head(df) # Filter variables and values df <- get_metadata_table_varval(idTable = 52056, filter = list(NAC = "00"), validate = FALSE) head(df)
Get all tables for a given operation
get_metadata_tables_operation( operation = NULL, det = 0, tip = NULL, geo = NULL, lang = "ES", page = 0, validate = TRUE, verbose = FALSE )get_metadata_tables_operation( operation = NULL, det = 0, tip = NULL, geo = NULL, lang = "ES", page = 0, validate = TRUE, verbose = FALSE )
operation |
(string): code of the operation. To obtain a list of
available operations see |
det |
(int): level of detail. Valid values: 0, 1 or 2. |
tip |
(string): set to 'A' for friendly output (e.g. readable dates), set to 'M' to include metadata or set to 'AM' for both. |
geo |
(int): set to 0 for national tables or set to 1 for tables with a greater level of disaggregation. |
lang |
(string): language of the retrieved data. Set to 'ES' for Spanish or set to 'EN' for English |
page |
(int): page number. The retrieved result of the query is paginated (page=0 retrieves all pages). |
validate |
(logical): validate input parameters. A FALSE value means fewer API calls. |
verbose |
(logical): print additional information, including the URL to call the API service. |
Data frame with information of the available tables according to the operation specified in the function
# Get all the tables of the "IPC" operation df <- get_metadata_tables_operation(operation = "IPC", validate = FALSE) head(df)# Get all the tables of the "IPC" operation df <- get_metadata_tables_operation(operation = "IPC", validate = FALSE) head(df)
Get all values for a specific variable
get_metadata_values( operation = NULL, variable = NULL, value = NULL, det = 0, lang = "ES", page = 0, classification = NULL, validate = TRUE, verbose = FALSE, hierarchy = NULL, filter = NULL )get_metadata_values( operation = NULL, variable = NULL, value = NULL, det = 0, lang = "ES", page = 0, classification = NULL, validate = TRUE, verbose = FALSE, hierarchy = NULL, filter = NULL )
operation |
(string): code of the operation. Provide code to get all
the values for the given operation. To obtain a list of
available operations see |
variable |
(int): id of a variable. To obtain a list of
available variables see |
value |
(int): id of a value. If an id value is specified, the children
of the value are requested. To obtain a list of
available values for a variable use |
det |
(int): level of detail. Valid values: 0, 1 or 2. |
lang |
(string): language of the retrieved data. Set to 'ES' for Spanish or set to 'EN' for English. |
page |
(int): page number. The retrieved result of the query is paginated (page=0 retrieves all pages). |
classification |
(int): id of a classification. To obtain a list of available
classifications see |
validate |
(logical): validate input parameters. A FALSE value means fewer API calls. |
verbose |
(logical): print additional information, including the URL to call the API service. |
hierarchy |
(int): depth of the hierarchy tree. |
filter |
(list): list of variables and values. When we request the hierarchy tree
there is the possibility of filtering using metadata information about the variables and their values
that define the series.
The format is
|
Data frame with information of the available values for the variable specified in the function
# Get the values of the variable "115" df <- get_metadata_values(variable = 115) head(df) # Get the values of a variable for a specific operation df <- get_metadata_values(operation = "IPC", variable = 115, validate = FALSE) head(df) # Get the children of a value (provinces of Galicia) # Variable: Autonomous communities (id=70) # Value: Galicia (id=9008) df <- get_metadata_values(variable = 70, value = 9008) head(df)# Get the values of the variable "115" df <- get_metadata_values(variable = 115) head(df) # Get the values of a variable for a specific operation df <- get_metadata_values(operation = "IPC", variable = 115, validate = FALSE) head(df) # Get the children of a value (provinces of Galicia) # Variable: Autonomous communities (id=70) # Value: Galicia (id=9008) df <- get_metadata_values(variable = 70, value = 9008) head(df)
Get all available variables
get_metadata_variables( operation = NULL, lang = "ES", det = 0, page = 0, validate = TRUE, verbose = FALSE )get_metadata_variables( operation = NULL, lang = "ES", det = 0, page = 0, validate = TRUE, verbose = FALSE )
operation |
(string): Code of the operation. Provide code to get all
the variables for the given operation. To obtain a list of
available operations see |
lang |
(string): language of the retrieved data. Set to 'ES' for Spanish or set to 'EN' for English. |
det |
(int): level of detail. Valid values: 0, 1 or 2. |
page |
(int): page number. The retrieved result of the query is paginated (page=0 retrieves all pages). |
validate |
(logical): validate input parameters. A FALSE value means fewer API calls. |
verbose |
(logical): print additional information, including the URL to call the API service. |
Data frame with information of the available variables
# Gel all variables df <- get_metadata_variables() head(df) # Get variables for a specific operation df <- get_metadata_variables(operation = "IPC", validate = FALSE) head(df)# Gel all variables df <- get_metadata_variables() head(df) # Get variables for a specific operation df <- get_metadata_variables(operation = "IPC", validate = FALSE) head(df)