doc-all | R Documentation |
px_nav
is used to navigate the API: it returns the possible
subdirectories as a tibble with dbid corresponding to the suffix in the url
that points to the given subdirectory.
px_nav(path = "", api = "https://statfin.stat.fi/PXWeb/api/v1/fi/") px_var(path, api = "https://statfin.stat.fi/PXWeb/api/v1/fi/") px_dl( path, var = px_var(path, api), simplify_colnames = FALSE, na_omit = FALSE, api = "https://statfin.stat.fi/PXWeb/api/v1/fi/" )
path |
suffix to the path after |
api |
The url to the API. Defaults to
|
var |
The values of the dimensions to be queried as a tibble. Can be
obtained by filtering from the result of |
simplify_colnames |
If |
na_omit |
If |
px_var
returns the values of the dimensions in the given table and
px_dl
returns the actual data corresponding to variables specified
as the var
argument. The format of the var
argument is the
same as in the tibble returned by px_var
, so the values can be
selected by filtering that tibble. See the examples for mode information.
px_dl
and px_var
always return a tibble.
px_nav
returns a tibble when request is sent to a non-table URL
(ie. an url corresponds to a directory rather than a particular data set).
# Navigate through the API # px_nav() # check what data is available under StatFin # px_nav("StatFin/") # navigate through the directories, # check what variables are available for population statistics # var <- px_var("StatFin/vrm/synt/statfin_synt_pxt_12dj.px", # "https://statfin.stat.fi/PXWeb/api/v1/en/") # select years after 1900 # var_1900 <- dplyr::filter(var, Year >= 1900) # Download the data, starting from year 1900, # omitting the var-argument would download the data for all the years. # data <- px_dl("StatFin/vrm/synt/statfin_synt_pxt_12dj.px", # var = var_1900, simplify_colnames = TRUE, # api = "https://statfin.stat.fi/PXWeb/api/v1/en/")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.