obj <- api_data(14162, Region = FALSE, InnKvartering1 = FALSE, Landkoder2 = FALSE,
ContentsCode = TRUE, Tid = 3i, url_type = "ssb_en")
obj[[1]] # The label version of the dataset, as returned by api_data_1()
obj[[2]] # The code version of the dataset, as returned by api_data_2()
names(obj)
info(obj) # Similar to comment(); see also note() below
# same as above
# api_data("https://data.ssb.no/api/pxwebapi/v2/tables/14162/data?lang=en",
# default_query = FALSE, ContentsCode = "*", Tid = "top(3)")
# also same as above
# api_data(14162, url_type = "ssb_en", default_query = FALSE,
# ContentsCode = list(valueCodes = "*"),
# Tid = list(valueCodes = "top(3)"))
api_data_1("https://data.ssb.no/api/pxwebapi/v2/tables/09546/data?lang=en",
Region = FALSE, SkoleSTR = "07", GrSkolOrgForm = "4",
EierforhSkole = 1:2, ContentsCode = TRUE, Tid = "202?")
api_data_2("https://data.ssb.no/api/pxwebapi/v2/tables/07459/data?lang=en",
Region = list(codelist = "agg_KommSummer",
valueCodes = c("K-3101", "K-3103"),
outputValues = "aggregated"),
Kjonn = TRUE,
Alder = list(codelist = "agg_TodeltGrupperingB",
valueCodes = c("H17", "H18"),
outputValues = "aggregated"),
ContentsCode = 1,
Tid = 2i)
# codes and labels can be mixed
api_data_12(4861,
Region = c("Sarpsborg", "3103", "402?"),
ContentsCode = "Bosatte",
Tid = c(1, -1),
url_type = "ssb_en")
# A Statistics Sweden example
api_data_12("https://statistikdatabasen.scb.se/api/v2/tables/TAB4537/data?lang=en",
Region = "??",
Kon = FALSE)
# Use default_query = TRUE to retrieve entire tables
out <- api_data_2("https://data.ssb.no/api/pxwebapi/v2/tables/10172/data?lang=en",
default_query = TRUE)
out[14:22, ] # 9 rows printed
# Use note() for explanation of status codes (see api_data() parameter makeNAstatus)
note(out)
# info() and note() return parts of the comment attribute
info(out)
comment(out)
Run the code above in your browser using DataLab