statfi_get_data: Get data from statfi

View source: R/get_data.R

statfi_get_dataR Documentation

Get data from statfi

Description

Downloads data from statfi and cleans it.

Usage

statfi_get_data(url, query, names = "none")

Arguments

url

A pxweb object or url that can be coherced to a pxweb object

query

A json string, json file or list object that can be coherced to a pxweb_query object.

names

Whether to add columns for names. "all", "none" or vector of variable names.

Examples

  url = "https://statfin.stat.fi/PXWeb/api/v1/fi/StatFin/tyti/statfin_tyti_pxt_11pk.px/"
  query <-
    list("Vuosi"=c("2010","2011"),
         "Sukupuoli"=c("SSS","1","2"),
         "Tiedot"=c("*"))

  pp <- statfi_get_data(url, query)
  pp <- statfi_get_data(url, query, names = "none")
  pp <- statfi_get_data(url, query, names = c("Sukupuoli"))

  url <- "https://statfin.stat.fi/PXWeb/api/v1/fi/StatFin/tyti/statfin_tyti_pxt_135y.px/"
  query <-
   list("Kuukausi"=c("*"),
        "Sukupuoli"=c("SSS"),
        "Ik\U00E4luokka" = c("15-64"),
        "Tiedot" = c("*"))

  pp2 <- statfi_get_data(url, query)

pttry/statfitools documentation built on Feb. 2, 2025, 1:50 a.m.