inegi_series {inegiR} | R Documentation |
Returns INEGI data series
Description
Returns a data.frame with the time series chosen from INEGI webservice. If the parameter Metadata is TRUE, a list is returned with two objects: data and metadata.
Usage
inegi_series(series_id, token, geography = "00", database = "BIE",
metadata = FALSE, lastonly = FALSE, as_tt = FALSE,
as_compact = FALSE)
Arguments
series_id |
an indicator ID. These are obtained via the INEGI API documentation. |
token |
API token supplied by INEGI. |
geography |
Geography code of INEGI. Defaults to 00 (National) |
database |
Is the id from BIE (Banco de Informacion Economica) or BISE (Banco de Indicadores)? Defaults to BIE. To learn more about what database your indicator is stored in, visit INEGI docs. |
metadata |
Defaults to FALSE, if TRUE, returns a list with metadata information. |
lastonly |
Do you want only the last observation? Defaults to FALSE. |
as_tt |
Do you want the output of the data.frame to be a tibble time object? Defaults to FALSE. |
as_compact |
Do you want the output always as a data.frame or time tibble? If the output contains metadata, each data point will be replicated in a column. If the output does not contain metadata there is no change. Previously, this was achieved with |
Value
data.frame or list
Note
Adding the entire INEGI URL as a series is deprecated since v3, due to a change of API specifications in INEGI. INEGI docs can be found at: https://www.inegi.org.mx/servicios/api_indicadores.html. Coercing biweekly indicators to monthly is also deprecated inside this function. Use tibbletime functions to coerce instead.
Author(s)
Eduardo Flores
Examples
## Not run:
# General INPC series
token <- "webservice_token"
inpc_id <- "216064"
INPC <- inegi_series(inpc_id, token)
## End(Not run)