View source: R/get_eurostat_json.R
get_eurostat_json | R Documentation |
Retrieve data from Eurostat API in JSON format.
get_eurostat_json( id, filters = NULL, type = "code", lang = "EN", stringsAsFactors = FALSE, ... )
id |
A code name for the dataset of interested. See the table of contents of eurostat datasets for more details. |
filters |
A named list of filters. Names of list objects are Eurostat
variable codes and values are vectors of observation codes. If |
type |
A type of variables, " |
lang |
A language used for metadata. Default is |
stringsAsFactors |
if |
... |
Arguments passed on to
|
Data to retrieve from
The Eurostat Web Services
can be specified with filters. Normally, it is
better to use JSON query through get_eurostat()
, than to use
get_eurostat_json()
directly.
Queries are limited to 50 sub-indicators at a time. A time can be
filtered with fixed "time" filter or with "sinceTimePeriod" and
"lastTimePeriod" filters. A sinceTimePeriod = 2000
returns
observations from 2000 to a last available. A lastTimePeriod = 10
returns a 10 last observations.
To use a proxy to connect, a httr::use_proxy()
can be
passed to httr::GET()
. For example
get_eurostat_json(id, filters, config = httr::use_proxy(url, port, username, password))
.
A dataset as an object of data.frame
class.
Przemyslaw Biecek, Leo Lahti, Janne Huovari Markus Kainu and Pyry Kantanen
See citation("eurostat")
:
# # Kindly cite the eurostat R package as follows: # # (C) Leo Lahti, Janne Huovari, Markus Kainu, Przemyslaw Biecek. # Retrieval and analysis of Eurostat open data with the eurostat # package. R Journal 9(1):385-392, 2017. doi: 10.32614/RJ-2017-019 # Package URL: http://ropengov.github.io/eurostat Article URL: # https://journal.r-project.org/archive/2017/RJ-2017-019/index.html # # A BibTeX entry for LaTeX users is # # @Article{, # title = {Retrieval and Analysis of Eurostat Open Data with the eurostat Package}, # author = {Leo Lahti and Janne Huovari and Markus Kainu and Przemyslaw Biecek}, # journal = {The R Journal}, # volume = {9}, # number = {1}, # pages = {385--392}, # year = {2017}, # doi = {10.32614/RJ-2017-019}, # url = {https://doi.org/10.32614/RJ-2017-019}, # }
httr::GET()
Eurostat Data Browser online help: API Statistics - data query: https://wikis.ec.europa.eu/display/EUROSTATHELP/API+Statistics+-+data+query
Eurostat Data Browser online help: migrating from JSON web service to API Statistics: https://wikis.ec.europa.eu/display/EUROSTATHELP/API+Statistics+-+migrating+from+JSON+web+service+to+API+Statistics
## Not run: # Generally speaking these queries would be done through get_eurostat tmp <- get_eurostat_json("nama_10_gdp") yy <- get_eurostat_json("nama_10_gdp", filters = list( geo = c("FI", "SE", "EU28"), time = c(2015:2023), lang = "FR", na_item = "B1GQ", unit = "CLV_I10" )) # TIME_PERIOD filter works also with the new JSON API yy2 <- get_eurostat_json("nama_10_gdp", filters = list( geo = c("FI", "SE", "EU28"), TIME_PERIOD = c(2015:2023), lang = "FR", na_item = "B1GQ", unit = "CLV_I10" )) # An example from get_eurostat dd <- get_eurostat("nama_10_gdp", filters = list( geo = "FI", na_item = "B1GQ", unit = "CLV_I10" )) ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.