SCB

0th

Percentile

Average age in Sweden

For the vignettes there is a dataset downloaded by using the get_pxweb_data() call. The data is from SCB (Statistics Sweden) and downloaded using the pxweb package:

Keywords
data
References

http://scb.se

Aliases
  • SCB
Examples
# NOT RUN {
# The data was generated through downloading via the API
library(pxweb)

# Get the last 15 years of data (the data always lags 1 year)
current_year <- as.integer(format(Sys.Date(), "%Y")) -1
SCB <- get_pxweb_data(
  url = "http://api.scb.se/OV0104/v1/doris/en/ssd/BE/BE0101/BE0101B/BefolkningMedelAlder",
  dims = list(Region = c('00', '01', '03', '25'),
              Kon = c('1', '2'),
              ContentsCode = c('BE0101G9'),
              Tid = (current_year-14):current_year),
  clean = TRUE)

# Some cleaning was needed before use
SCB$region <- factor(substring(as.character(SCB$region), 4))
Swe_ltrs <- c("<U+00E5>" = "å",
              "<U+00C5>" = "Å",
              "<U+00E4>" = "ä",
              "<U+00C4>" = "Ä",
              "<U+00F6>" = "ö",
              "<U+00D6>" = "Ö")
for (i in 1:length(Swe_ltrs)){
  levels(SCB$region) <- gsub(names(Swe_ltrs)[i],
              Swe_ltrs[i],
              levels(SCB$region))
}

save(SCB, file = "data/SCB.rda")
# }
Documentation reproduced from package htmlTable, version 1.13.3, License: GPL (>= 3)

Community examples

Looks like there are no examples yet.