scb_query: Query a table in the SCB Database

Description Usage Arguments Details Value Examples

Description

This is essentially a wrapper for POST, with some more intuitive and user-friendly handling of arguments and output. The ... arguments should be named lists of the form list(code = variable_code_to_filter_on, filter = type_of_filter_to_use, values = values_to_filter_on). These are converted to JSON with the jsonlite package, and submitted as the body in POST.

Usage

1
scb_query(table_id, ..., lang = "en", database_id = "ssd")

Arguments

table_id

ID path of table to query

...

Arguments to query table with, each like: list(code = code_to_query, filter = filter_type, values = c(values_to_filter))

lang

Language "en" English or "sv" Swedish

database_id

ID of database; currently only "ssd"

Details

The types of filter that can be used are:

For more information, see https://www.scb.se/api/.

Value

list containing status code and data.frame with response from POST query

Examples

1
2
3
4
5
6
7
8
## Not run: 
scb_query(
  table_id = "AM/AM0101/AM0101A/LonArb07Privat",
  list(code = "Overtidstillagg", filter = "item", values = "10"),
  list(code = "Tid", filter = "top", values = "5"),
  list(code = "SNI2007", filter = "item", values = c("B", "C")))

## End(Not run)

olhmr/rscb documentation built on May 15, 2019, 10:40 p.m.