ptt_get_statfi: Get PTT data from statfi

View source: R/ptt_statfi.R

ptt_get_statfiR Documentation

Get PTT data from statfi

Description

Downloads data from statfi and modifies data to ptt-form.

Usage

ptt_get_statfi(
  url,
  query,
  names = "all",
  check_classifications = TRUE,
  renames = NULL
)

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.

check_classifications

A locigal whether to check region classification.

renames

to rename variables.

Examples

  url = "https://statfin.stat.fi/PXWeb/api/v1/fi/StatFin/vkour/statfin_vkour_pxt_12bq.px"
  query <-
    list("Vuosi"=c("1970","1975"),
         "Alue"=c("SSS","KU020","KU005"),
         "Ik\U00E4"=c("SSS","15-19"),
         "Sukupuoli"=c("SSS","1","2"),
         "Koulutusaste"=c("SSS","3T8"),
         "Tiedot"=c("vaesto"))

  pp <- ptt_get_statfi(url, query)
  pp <- ptt_get_statfi(url, query, names = "none")
  pp <- ptt_get_statfi(url, query, names = c("Alue"))

  url <- "https://statfin.stat.fi/PXWeb/api/v1/fi/Kokeelliset_tilastot/nopsu/koeti_nopsu_pxt_11mx.px"
  query <-
   list("Vuosinelj\U00E4nnes"=c("2019Q1", "2019Q2", "2019Q3", "2019Q4"),
        "Tiedot"=c("alkuperainen_euro",
                   "tyopaivakorjattu_euro",
                   "kausitasoitettu_euro",
                   "trendi_euro"))

  pp2 <- ptt_get_statfi(url, query)

pttry/pttdatahaku documentation built on Jan. 25, 2025, 10:37 a.m.