BFS

🇨🇭Search and Download Data from the Swiss Federal Statistical Office

https://github.com/lgnbhl/bfs

Science Score: 26.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • â—‹
    CITATION.cff file
  • âś“
    codemeta.json file
    Found codemeta.json file
  • âś“
    .zenodo.json file
    Found .zenodo.json file
  • â—‹
    DOI references
  • â—‹
    Academic publication links
  • â—‹
    Committers with academic emails
  • â—‹
    Institutional organization owner
  • â—‹
    JOSS paper metadata
  • â—‹
    Scientific vocabulary similarity
    Low similarity (19.2%) to scientific vocabulary

Keywords

r r-package switzerland
Last synced: 9 months ago · JSON representation

Repository

🇨🇭Search and Download Data from the Swiss Federal Statistical Office

Basic Info
Statistics
  • Stars: 21
  • Watchers: 1
  • Forks: 5
  • Open Issues: 3
  • Releases: 7
Topics
r r-package switzerland
Created over 8 years ago · Last pushed 12 months ago
Metadata Files
Readme Changelog License Code of conduct Codemeta

README.Rmd

---
output: github_document
editor_options: 
  chunk_output_type: console
---




[![CRAN status](https://www.r-pkg.org/badges/version/BFS)](https://CRAN.R-project.org/package=BFS)
[![Grand total](https://cranlogs.r-pkg.org/badges/grand-total/BFS)](https://cran.r-project.org/package=BFS)
[![R-CMD-check](https://github.com/lgnbhl/BFS/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/lgnbhl/BFS/actions/workflows/R-CMD-check.yaml)
[![Codecov test coverage](https://codecov.io/gh/lgnbhl/BFS/branch/master/graph/badge.svg)](https://app.codecov.io/gh/lgnbhl/BFS?branch=master)
[![LinkedIn](https://img.shields.io/badge/LinkedIn-Follow-E4405F?style=social&logo=linkedin)](https://www.linkedin.com/in/FelixLuginbuhl/)
[![Codecov test coverage](https://codecov.io/gh/lgnbhl/BFS/graph/badge.svg)](https://app.codecov.io/gh/lgnbhl/BFS)


# BFS 

```{r setup, include=FALSE}
knitr::opts_chunk$set(
	echo = TRUE,
	message = FALSE,
	warning = FALSE
)
```

> Search and download data from the Swiss Federal Statistical Office

The `BFS` package allows to search and download public data from the 
[Swiss Federal Statistical Office](https://www.bfs.admin.ch/bfs/en/home/statistics/catalogue.html){target="_blank"} (BFS stands for *Bundesamt fĂĽr Statistik* in German) APIs in a dynamic and reproducible way.

## Installation

```r
install.packages("BFS")
```

You can also install the development version from Github.

```r
devtools::install_github("lgnbhl/BFS")
```

## Usage

```{r}
library(BFS)
```

### Get the data catalog

Before downloading a BFS dataset, you need to get its related BFS number (FSO number) in the [official data catalog](https://www.bfs.admin.ch/bfs/en/home/statistics/catalogue.html). You can search in the catalog directly from R using the `bfs_get_catalog_data()` function in any language ("de", "fr", "it" or "en"):

```{r}
bfs_get_catalog_data(language = "en", extended_search = "student")
```

You can search in the data catalog using the following arguments:

- `language`: The language of a BFS catalog, i.e. "de", "fr", "it" or "en".
- `title`: to search in title, subtitle and supertitle.
- `extended_search`: extended search in (sub/super)title, orderNr, summary, shortSummary, shortTextGNP.
- `spatial_division`: choose between "Switzerland", "Cantons", "Districts", "Communes", "Other spatial divisions" or "International".
- `prodima`: by specific BFS themes using a unique prodima number.
- `inquiry`: by inquiry number.
- `institution`: by institution.
- `publishing_year_start`: by publishing year start.
- `publishing_year_end`: by publishing year end.
- `order_nr`: by BFS Number (FSO number).
- `limit`: limit of query results (API limit seems to be 350)
- `article_model_group`:  article model group
- `article_model`: article model

Note that English ("en") and Italian ("it") data catalogs offer a limited list of datasets. For the full list please get the French ("fr") or German ("de") data catalogs (see `language_available` column).

To return all the catalog metadata in the raw (uncleaned) structure, you can add `return_raw = TRUE`:

```{r}
catalog_raw <- bfs_get_catalog_data(
  language = "en", 
  extended_search = "student", 
  return_raw = TRUE
)

catalog_raw
```

The data catalog in a raw structure returns a data.frame containing nested data.frames in some columns. Here an example to get the `description` nested data.frame as a tibble:

```{r}
library(dplyr)

as_tibble(catalog_raw$description)
```

As the API limit is 350 results, you can get the full data catalog by looping on specific parameters. For example, you can loop over all `prodima` numbers (equivalent to BFS themes):

```{r}
# themes_names <- c("Statistical basis and overviews 00", "Population 01", "Territory and environment 02", "Work and income 03", "National economy 04", "Prices 05", "Industry and services 06", "Agriculture and forestry 07", "Energy 08", "Construction and housing 09", "Tourism 10", "Mobility and transport 11", "Money, banks and insurance 12", "Social security 13", "Health 14", "Education and science 15", "Culture, media, information society, sports 16", "Politics 17", "General Government and finance 18", "Crime and criminal justice 19", "Economic and social situation of the population 20", "Sustainable development, regional and international disparities 21")
themes_prodima <- c(900001, 900010, 900035, 900051, 900075, 900084, 900092, 900104, 900127, 900140, 900160, 900169, 900191, 900198, 900210, 900212, 900214, 900226, 900239, 900257, 900269, 900276)

library(purrr)

catalog_all <- purrr::pmap_dfr(
  .l = list(language = "de", prodima = themes_prodima, return_raw = TRUE),
  .f = bfs_get_catalog_data,
)

catalog_all

# to not overload the server, please save the data frame locally
# readr::write_csv(catalog_all, "catalog_all.csv") 
# catalog_all <- readr::read_csv("catalog_all.csv") 
```

Please use this loop moderately to not overload BFS server unnecessarily (just run it when needed and save the result locally).

### Download data in any language

The function `bfs_get_data()` allows you to download any dataset from the [BFS catalog](https://www.bfs.admin.ch/bfs/en/home/statistics/catalogue.html) (equivalent to selecting "data" in the "Article Type" dropdown of the BFS website) using its BFS number (FSO number).

Using the `number_bfs` argument (FSO number), you can get BFS data in a given language ("en", "de", "fr" or "it") from the official PXWeb API of the Swiss Federal Statistical Office. 

```{r}
#catalog_student$number_bfs[1] # px-x-1502040100_131
bfs_get_data(number_bfs = "px-x-1502040100_131", language = "en")
```

### "Too Many Requests" error message

When running the `bfs_get_data()` function you may get the following error message (issue [#7](https://github.com/lgnbhl/BFS/issues/7)).

```
Error in pxweb_advanced_get(url = url, query = query, verbose = verbose) : 
  Too Many Requests (RFC 6585) (HTTP 429).
```

This could happen because you ran too many times a `bfs_get_*()` function (API config is [here](https://www.pxweb.bfs.admin.ch/api/v1/de/?config)). A solution is to wait a few seconds before running the next `bfs_get_*()` function. You can add a delay in your R code using the `delay` argument.

```r
bfs_get_data(
  number_bfs = "px-x-1502040100_131", 
  language = "en", 
  delay = 10
)
```

If the error message remains, it could be because you are querying a very large BFS dataset. Two workarounds exist: a) download the BFS file using `bfs_download_asset()` to read it locally or b) query only specific elements of the data to reduce the API call (see next section).

Here an example using the `bfs_download_asset()` function:

```r
BFS::bfs_download_asset(
  number_bfs = "px-x-1502040100_131", #number_asset also possible
  destfile = "px-x-1502040100_131.px"
)

library(pxR) # install.packages("pxR")
large_dataset <- pxR::read.px(filename = "px-x-1502040100_131.px") |>
  as.data.frame()
```

Note that reading a PX file using `pxR::read.px()` gives access only to the German version.

### Query specific elements

First you want to get the metadata of your dataset, i.e. the variables (`code` and `text`) and dimensions (`values` and `valueTexts`). For example:

```r
metadata <- bfs_get_metadata(number_bfs = "px-x-1502040100_131", language = "en")

# tidy metadata
library(dplyr)
library(tidyr) # for unnest_longer

metadata_tidy <- metadata |>
  unnest_longer(c(values, valueTexts))

metadata_tidy
```

    ## # A tibble: 92 Ă— 7
    ##    code  text  values valueTexts time  elimination
    ##                     
    ##  1 Jahr  Year  0      1980/81    TRUE  NA         
    ##  2 Jahr  Year  1      1981/82    TRUE  NA         
    ##  3 Jahr  Year  2      1982/83    TRUE  NA         
    ##  4 Jahr  Year  3      1983/84    TRUE  NA         
    ##  5 Jahr  Year  4      1984/85    TRUE  NA         
    ##  6 Jahr  Year  5      1985/86    TRUE  NA         
    ##  7 Jahr  Year  6      1986/87    TRUE  NA         
    ##  8 Jahr  Year  7      1987/88    TRUE  NA         
    ##  9 Jahr  Year  8      1988/89    TRUE  NA         
    ## 10 Jahr  Year  9      1989/90    TRUE  NA         
    ## # ℹ 82 more rows
    ## # ℹ 1 more variable: title 

Then you can filter the dimensions you want to query using the `text` and `valueTexts` variables and build the query dimension object with the `code` and `values` variables.

```r
# select dimensions
dim1 <- metadata_tidy |>
  filter(text == "Year" & valueTexts %in% c("2020/21", "2021/22"))
dim2 <- metadata_tidy |>
  filter(text == "Level of study" & valueTexts %in% c("Master", "Doctorate"))
dim3 <- metadata_tidy |>
  filter(text == "ISCED Field" & valueTexts %in% c("Education science"))
dim4 <- metadata_tidy |>
  filter(text == "Sex") # all valueTexts dimensions

# build dimensions list object
dimensions <- list(
  dim1$values,
  dim2$values,
  dim3$values,
  dim4$values
)

names(dimensions) <- c(
  unique(dim1$code), 
  unique(dim2$code), 
  unique(dim3$code), 
  unique(dim4$code)
)

dimensions
```

    ## $Jahr
    ## [1] "40" "41"
    ## 
    ## $Studienstufe
    ## [1] "2" "3"
    ## 
    ## $`ISCED Fach`
    ## [1] "0"
    ## 
    ## $Geschlecht
    ## [1] "0" "1"

Finally you can query BFS data with specific dimensions.

```r
BFS::bfs_get_data(
  number_bfs = "px-x-1502040100_131",
  language = "en",
  query = dimensions
  )
```

    ## # A tibble: 8 Ă— 5
    ##   Year    `ISCED Field`     Sex    `Level of study` `University students`
    ##                                                 
    ## 1 2020/21 Education science Male   Master                             151
    ## 2 2020/21 Education science Male   Doctorate                          121
    ## 3 2020/21 Education science Female Master                             555
    ## 4 2020/21 Education science Female Doctorate                          306
    ## 5 2021/22 Education science Male   Master                             143
    ## 6 2021/22 Education science Male   Doctorate                          115
    ## 7 2021/22 Education science Female Master                             599
    ## 8 2021/22 Education science Female Doctorate                          318

### Catalog of tables

A lot of datasets are not accessible through the official PXWeb API. They are listed in the [data catalog](https://www.bfs.admin.ch/bfs/en/home/statistics/catalogue.html) as "tables" in the "Article Type" dropdown of the BFS website. You can search for specific tables using `bfs_get_catalog_tables()`.

```{r}
catalog_tables_en_students <- bfs_get_catalog_tables(language = "en", extended_search = "students")

catalog_tables_en_students
```

Most of the BFS tables are Excel or CSV files. You can download an table with `bfs_download_asset()` using the `number asset`.

```r
library(dplyr)

tables_asset_number_students <- catalog_tables_en_students |>
  dplyr::filter(title == "Students at universities and institutes of technology: Basistables") |>
  dplyr::pull(number_asset)

file_path <- BFS::bfs_download_asset(
  number_asset = tables_asset_number_students,
  destfile = "su-e-15.02.04.01.xlsx"
)
```

To return all the catalog metadata in the raw (uncleaned) structure, you can add `return_raw = TRUE`:

```{r}
catalog_tables_raw <- bfs_get_catalog_tables(
  language = "en", 
  extended_search = "student", 
  return_raw = TRUE
)

catalog_tables_raw
```

The data catalog in a raw structure returns a data.frame containing nested data.frames in some columns. Here an example to get the `description` nested data.frame as a tibble:

```{r}
library(dplyr)

as_tibble(catalog_tables_raw$description)
```

## Access geodata catalog

Display geo-information catalog of the Swiss Official STAC API using `bfs_get_catalog_geodata()`.

```r
library(rstac) # install.packages("rstac")

catalog_geodata <- bfs_get_catalog_geodata(include_metadata = TRUE)

catalog_geodata
```

    ## # A tibble: 281 Ă— 12
    ##    collection_id     type  href  title description created updated crs   license
    ##                                    
    ##  1 ch.are.agglomera… API   http… Citi… "The list … 2021-1… 2023-0… http… propri…
    ##  2 ch.are.alpenkonv… API   http… Alpi… "The perim… 2021-1… 2022-0… http… propri…
    ##  3 ch.are.belastung… API   http… Load… "Passenger… 2021-1… 2022-0… http… propri…
    ##  4 ch.are.belastung… API   http… Load… "Passenger… 2021-1… 2022-0… http… propri…
    ##  5 ch.are.belastung… API   http… Load… "Vehicles … 2021-1… 2022-0… http… propri…
    ##  6 ch.are.belastung… API   http… Load… "Vehicles … 2021-1… 2022-0… http… propri…
    ##  7 ch.are.erreichba… API   http… Acce… "Accessibi… 2021-1… 2022-0… http… propri…
    ##  8 ch.are.erreichba… API   http… Acce… "Accessibi… 2021-1… 2022-0… http… propri…
    ##  9 ch.are.gemeindet… API   http… Typo… "The typol… 2021-1… 2022-0… http… propri…
    ## 10 ch.are.gueteklas… API   http… Publ… "The publi… 2021-1… 2023-0… http… propri…
    ## # ℹ 271 more rows
    ## # ℹ 3 more variables: provider_name , bbox , inverval 


### Download geodata

For example you can get information about the dataset "Generalised borders G1 and area with urban character".

```r
library(dplyr)

geodata_g1 <- catalog_geodata |>
  filter(title == "Generalised borders G1 and area with urban character")
  
geodata_g1
```

    ## # A tibble: 1 Ă— 12
    ##   collection_id      type  href  title description created updated crs   license
    ##                                    
    ## 1 ch.bfs.generalisi… API   http… Gene… Administra… 2022-0… 2023-0… http… propri…
    ## # ℹ 3 more variables: provider_name , bbox , inverval 


Download dataset by collection id with `bfs_download_geodata()` and unzip file if needed.

```r
# Access Generalised borders G1 and area with urban character
borders_g1_path <- bfs_download_geodata(
  collection_id = "ch.bfs.generalisierte-grenzen_agglomerationen_g1", 
  output_dir = tempdir() #  temporary directory
)

# you may need to unzip the file
unzip(borders_g1_path[4], exdir = "borders_G1")
```

By default, the files are downloaded in a temporary directory. You can specify the folder where saving the files using the `output_dir` argument.

Some layers are accessible using WMS (Web Map Service):

```r
library(leaflet)

leaflet() %>% 
  setView(lng = 8, lat = 46.8, zoom = 8) %>%
  addWMSTiles(
    baseUrl = "https://wms.geo.admin.ch/?", 
    layers = "ch.bfs.generalisierte-grenzen_agglomerationen_g2",
    options = WMSTileOptions(format = "image/png", transparent = TRUE),
    attribution = "Generalised borders G1 © 2024 BFS")
```



### Cartographic base maps

You can get [cartographic base maps](https://www.bfs.admin.ch/bfs/en/home/statistics/regional-statistics/base-maps/cartographic-bases.assetdetail.30566934.html) from the ThemaKart project using `bfs_get_base_maps()`. The list of available geometries in the [official documentation](https://www.bfs.admin.ch/bfs/en/home/statistics/regional-statistics/base-maps/cartographic-bases.html).

The default arguments of `bfs_get_base_maps()` can be change to access specific files:

```r
library(sf) install.packages("sf")

# default arguments
bfs_get_base_maps(
  geom = NULL,
  category = "gf", # "gf" for total area (i.e. "Gesamtflaeche")
  type = "Poly",
  date = NULL,
  most_recent = TRUE, #get most recent file by default
  format = "shp",
  asset_number = "24025646" #change ThemaKart geodata as updated every year
)
```

A typical base maps ThemaKart file looks like this:



All available geometry files in ThemaKart asset can be listed using `return_sf = FALSE`:

```r
all_themakart_files <- bfs_get_base_maps(
  return_sf = FALSE, # do NOT return sf object
  asset_number = "30566934", # ThemaKart asset of 2024
  geom = "", 
  category = "", 
  type = "", 
  format = "",
  date = ""
)

length(all_themakart_files) # number of files available
```

    ## [1] 701

For example, all available river files can be found with:

```r
all_river_files <- bfs_get_base_maps(
    return_sf = FALSE, # do NOT return sf object
    asset_number = "30566934", # ThemaKart asset of 2024
    geom = "flus", # "flus" for river related files
    category = "", 
    type = "", 
    format = "shp",
    date = ""
)
```

The function `bfs_get_base_maps()` eases file selection with arguments and returns an sf object by default.

```r
switzerland_sf <- bfs_get_base_maps(geom = "suis")
communes_sf <- bfs_get_base_maps(geom = "polg")
districts_sf <- bfs_get_base_maps(geom = "bezk")
cantons_sf <- bfs_get_base_maps(geom = "kant")
cantons_capitals_sf <- bfs_get_base_maps(geom = "stkt", type = "Pnts", category = "kk")
lakes_sf <- bfs_get_base_maps(geom = "seen", category = "11")
# for some reason rivers don't have a "type" in their file names, so add type = ""
rivers_sf <- bfs_get_base_maps(geom = "flus", type = "", category = "22")

library(ggplot2)

ggplot() + 
  geom_sf(data = communes_sf, fill = "snow", color = "grey45") + 
  geom_sf(data = lakes_sf, fill = "lightblue2", color = "black") +
  geom_sf(data = districts_sf, fill = "transparent", color = "grey65") + 
  geom_sf(data = cantons_sf, fill = "transparent", color = "black") +
  geom_sf(data = rivers_sf, color = "lightblue2", lwd = 1) +
  geom_sf(data = cantons_capitals_sf, shape = 18, size = 3) +
  theme_minimal() +
  theme(axis.text = element_blank()) +
  labs(caption = "Source: ThemaKart, © BFS")
```



Note that the geometries are available for different date of data release. By default, `bfs_get_base_maps()` tries to get the most recent date. You can specify the date using the "date" argument.

You can create an interactive map easily with the mapview R package.

```r
library(mapview)

BFS::bfs_get_base_maps(geom = "bezk") |>
  mapview(zcol = "name", legend = FALSE)
```



### Get official list of Swiss municipalities

You can also get the historicized list of Swiss municipalities from the official BFS API using the new **swissMunicipalities** R package. The documentation is [here](https://github.com/SwissStatsR/swissMunicipalities).

```r
# remotes::install_github("SwissStatsR/swissMunicipalities")
library(swissMunicipalities)
library(dplyr) # just for data wrangling

# snapshot of today list of Swiss municipalites/districts/cantons
snapshot <- swissMunicipalities::get_snapshots(hist_id = TRUE)

municipalities <- snapshot |> 
  filter(Level == 3) |>
  rename_with(~ paste0(.x, "_municipality", recycle0 = TRUE)) |>
  select(-Level_municipality)

districts <- snapshot |> 
  filter(Level == 2) |>
  rename_with(~ paste0(.x, "_district", recycle0 = TRUE)) |>
  select(-Level_district)

cantons <- snapshot |> 
  filter(Level == 1) |>
  rename_with(~ paste0(.x, "_canton", recycle0 = TRUE)) |>
  select(-Level_canton)

# consolidate municipality data with districts and cantons levels
municipalities_consolidated <- municipalities |>
  left_join(districts, by = join_by(Parent_municipality == Identifier_district)) |>
  left_join(cantons, by = join_by(Parent_district == Identifier_canton)) |>
  rename(Identifier_district = Parent_municipality, Identifier_canton = Parent_district) |>
  select(starts_with(c("Identifier", "Name", "ABBREV", "Valid")), everything()) |>
  arrange(Identifier_municipality, Identifier_district)

municipalities_consolidated
```

    # A tibble: 2,131 Ă— 82
       Identifier_municipality Identifier_district Identifier_canton Name_en_municipality Name_fr_municipality
                                                                                     
     1                       1                 101                 1 Aeugst am Albis      Aeugst am Albis     
     2                       2                 101                 1 Affoltern am Albis   Affoltern am Albis  
     3                       3                 101                 1 Bonstetten           Bonstetten          
     4                       4                 101                 1 Hausen am Albis      Hausen am Albis     
     5                       5                 101                 1 Hedingen             Hedingen            
     6                       6                 101                 1 Kappel am Albis      Kappel am Albis     
     7                       7                 101                 1 Knonau               Knonau              
     8                       8                 101                 1 Maschwanden          Maschwanden         
     9                       9                 101                 1 Mettmenstetten       Mettmenstetten      
    10                      10                 101                 1 Obfelden             Obfelden            
    # ℹ 2,121 more rows
    # ℹ 77 more variables: Name_de_municipality , Name_it_municipality , Name_en_district ,
    #   Name_fr_district , Name_de_district , Name_it_district , Name_en_canton ,
    #   Name_fr_canton , Name_de_canton , Name_it_canton , ABBREV_1_Text_en_municipality ,
    #   ABBREV_1_Text_fr_municipality , ABBREV_1_Text_de_municipality , ABBREV_1_Text_it_municipality ,
    #   ABBREV_1_Text_municipality , ABBREV_1_Text_en_district , ABBREV_1_Text_fr_district ,
    #   ABBREV_1_Text_de_district , ABBREV_1_Text_it_district , ABBREV_1_Text_district , …
    # ℹ Use `print(n = ...)` to see more rows

You can now use the consolidated list of Swiss municipalities to ease geodata analysis.

```r
library(sf)
library(ggplot2)

communes_sf <- bfs_get_base_maps(geom = "polg", date = "20230101")

communes_ge <- communes_sf |>
  inner_join(municipalities_consolidated |>
               filter(Name_de_canton == "Genève"), 
             by = c("id" = "Identifier_municipality"))

bbox_ge <- sf::st_bbox(communes_ge)

lake_leman <- bfs_get_base_maps(geom = "seen", category = "11") |>
  filter(name == "Lac Léman")

communes_ge |> 
  ggplot() + 
  geom_sf(data = lake_leman, fill = "lightblue2", color = "grey65") +
  geom_sf(fill = "snow", color = "grey65") + 
  geom_sf_text(aes(label = name), size = 3, check_overlap = T) + 
  # bounding box
  coord_sf(
    xlim = c(bbox_ge$xmin, bbox_ge$xmax),
    ylim = c(bbox_ge$ymin, bbox_ge$ymax)
  ) +
  theme_minimal() +
  theme(axis.text = element_blank()) +
  labs(title = "Communes du canton de Genève",
       x = NULL, y = NULL, 
       caption = "Source: ThemaKart, © BFS")
```



## Main dependencies of the package

Under the hood, this package is using the [pxweb](https://ropengov.github.io/pxweb/index.html){target="_blank"} package to query the Swiss Federal Statistical Office PXWEB API. PXWEB is an API structure developed by Statistics Sweden and other national statistical institutions (NSI) to disseminate public statistics in a structured way. To query the Geo Admin STAC API, this package is using the [rstac](https://brazil-data-cube.github.io/rstac/) package. STAC is a specification of files and web services used to describe geospatial information assets.

You can clean the column names of the datasets automatically using `janitor::clean_names()` by adding the argument `clean_names = TRUE` in the `bfs_get_data()` function. 

## Other information

This package is in no way officially related to or endorsed by the Swiss Federal Statistical Office (BFS).

## Contribute

Any contribution is strongly appreciated. Feel free to report a bug, ask any question or make a pull request for any remaining [issue](https://github.com/lgnbhl/BFS/issues).

Owner

  • Name: FĂ©lix Luginbuhl
  • Login: lgnbhl
  • Kind: user
  • Location: Switzerland

R and data viz

CodeMeta (codemeta.json)

{
  "@context": "https://doi.org/10.5063/schema/codemeta-2.0",
  "@type": "SoftwareSourceCode",
  "identifier": "BFS",
  "description": "Search and download data from the Swiss Federal Statistical Office (BFS) APIs <https://www.bfs.admin.ch/>.",
  "name": "BFS: Get Data from the Swiss Federal Statistical Office",
  "relatedLink": [
    "https://felixluginbuhl.com/BFS/",
    "https://CRAN.R-project.org/package=BFS"
  ],
  "codeRepository": "https://github.com/lgnbhl/BFS/",
  "issueTracker": "https://github.com/lgnbhl/BFS/issues",
  "license": "https://spdx.org/licenses/MIT",
  "version": "0.5.6",
  "programmingLanguage": {
    "@type": "ComputerLanguage",
    "name": "R",
    "url": "https://r-project.org"
  },
  "runtimePlatform": "R version 4.3.1 (2023-06-16 ucrt)",
  "provider": {
    "@id": "https://cran.r-project.org",
    "@type": "Organization",
    "name": "Comprehensive R Archive Network (CRAN)",
    "url": "https://cran.r-project.org"
  },
  "author": [
    {
      "@type": "Person",
      "givenName": "Felix",
      "familyName": "Luginbuhl",
      "email": "felix.luginbuhl@protonmail.ch",
      "@id": "https://orcid.org/0009-0008-6625-2899"
    }
  ],
  "contributor": [
    {
      "@type": "Person",
      "givenName": "Janosch",
      "familyName": "Brenzel-Weiss"
    },
    {
      "@type": "Person",
      "givenName": "Joao",
      "familyName": "Martins"
    },
    {
      "@type": "Person",
      "givenName": "Philipp",
      "familyName": "Baumann",
      "email": "baumann-philipp@protonmail.com",
      "@id": "https://orcid.org/0000-0002-3194-8975"
    }
  ],
  "maintainer": [
    {
      "@type": "Person",
      "givenName": "Felix",
      "familyName": "Luginbuhl",
      "email": "felix.luginbuhl@protonmail.ch"
    }
  ],
  "softwareSuggestions": [
    {
      "@type": "SoftwareApplication",
      "identifier": "testthat",
      "name": "testthat",
      "version": ">= 3.0.0",
      "provider": {
        "@id": "https://cran.r-project.org",
        "@type": "Organization",
        "name": "Comprehensive R Archive Network (CRAN)",
        "url": "https://cran.r-project.org"
      },
      "sameAs": "https://CRAN.R-project.org/package=testthat"
    }
  ],
  "softwareRequirements": {
    "1": {
      "@type": "SoftwareApplication",
      "identifier": "R",
      "name": "R",
      "version": ">= 3.4"
    },
    "2": {
      "@type": "SoftwareApplication",
      "identifier": "pxweb",
      "name": "pxweb",
      "provider": {
        "@id": "https://cran.r-project.org",
        "@type": "Organization",
        "name": "Comprehensive R Archive Network (CRAN)",
        "url": "https://cran.r-project.org"
      },
      "sameAs": "https://CRAN.R-project.org/package=pxweb"
    },
    "3": {
      "@type": "SoftwareApplication",
      "identifier": "httr2",
      "name": "httr2",
      "provider": {
        "@id": "https://cran.r-project.org",
        "@type": "Organization",
        "name": "Comprehensive R Archive Network (CRAN)",
        "url": "https://cran.r-project.org"
      },
      "sameAs": "https://CRAN.R-project.org/package=httr2"
    },
    "4": {
      "@type": "SoftwareApplication",
      "identifier": "xml2",
      "name": "xml2",
      "provider": {
        "@id": "https://cran.r-project.org",
        "@type": "Organization",
        "name": "Comprehensive R Archive Network (CRAN)",
        "url": "https://cran.r-project.org"
      },
      "sameAs": "https://CRAN.R-project.org/package=xml2"
    },
    "5": {
      "@type": "SoftwareApplication",
      "identifier": "rvest",
      "name": "rvest",
      "provider": {
        "@id": "https://cran.r-project.org",
        "@type": "Organization",
        "name": "Comprehensive R Archive Network (CRAN)",
        "url": "https://cran.r-project.org"
      },
      "sameAs": "https://CRAN.R-project.org/package=rvest"
    },
    "6": {
      "@type": "SoftwareApplication",
      "identifier": "tibble",
      "name": "tibble",
      "provider": {
        "@id": "https://cran.r-project.org",
        "@type": "Organization",
        "name": "Comprehensive R Archive Network (CRAN)",
        "url": "https://cran.r-project.org"
      },
      "sameAs": "https://CRAN.R-project.org/package=tibble"
    },
    "7": {
      "@type": "SoftwareApplication",
      "identifier": "magrittr",
      "name": "magrittr",
      "provider": {
        "@id": "https://cran.r-project.org",
        "@type": "Organization",
        "name": "Comprehensive R Archive Network (CRAN)",
        "url": "https://cran.r-project.org"
      },
      "sameAs": "https://CRAN.R-project.org/package=magrittr"
    },
    "8": {
      "@type": "SoftwareApplication",
      "identifier": "janitor",
      "name": "janitor",
      "provider": {
        "@id": "https://cran.r-project.org",
        "@type": "Organization",
        "name": "Comprehensive R Archive Network (CRAN)",
        "url": "https://cran.r-project.org"
      },
      "sameAs": "https://CRAN.R-project.org/package=janitor"
    },
    "9": {
      "@type": "SoftwareApplication",
      "identifier": "tidyRSS",
      "name": "tidyRSS",
      "provider": {
        "@id": "https://cran.r-project.org",
        "@type": "Organization",
        "name": "Comprehensive R Archive Network (CRAN)",
        "url": "https://cran.r-project.org"
      },
      "sameAs": "https://CRAN.R-project.org/package=tidyRSS"
    },
    "10": {
      "@type": "SoftwareApplication",
      "identifier": "purrr",
      "name": "purrr",
      "provider": {
        "@id": "https://cran.r-project.org",
        "@type": "Organization",
        "name": "Comprehensive R Archive Network (CRAN)",
        "url": "https://cran.r-project.org"
      },
      "sameAs": "https://CRAN.R-project.org/package=purrr"
    },
    "11": {
      "@type": "SoftwareApplication",
      "identifier": "dplyr",
      "name": "dplyr",
      "provider": {
        "@id": "https://cran.r-project.org",
        "@type": "Organization",
        "name": "Comprehensive R Archive Network (CRAN)",
        "url": "https://cran.r-project.org"
      },
      "sameAs": "https://CRAN.R-project.org/package=dplyr"
    },
    "12": {
      "@type": "SoftwareApplication",
      "identifier": "rstac",
      "name": "rstac",
      "provider": {
        "@id": "https://cran.r-project.org",
        "@type": "Organization",
        "name": "Comprehensive R Archive Network (CRAN)",
        "url": "https://cran.r-project.org"
      },
      "sameAs": "https://CRAN.R-project.org/package=rstac"
    },
    "13": {
      "@type": "SoftwareApplication",
      "identifier": "curl",
      "name": "curl",
      "provider": {
        "@id": "https://cran.r-project.org",
        "@type": "Organization",
        "name": "Comprehensive R Archive Network (CRAN)",
        "url": "https://cran.r-project.org"
      },
      "sameAs": "https://CRAN.R-project.org/package=curl"
    },
    "14": {
      "@type": "SoftwareApplication",
      "identifier": "sf",
      "name": "sf",
      "provider": {
        "@id": "https://cran.r-project.org",
        "@type": "Organization",
        "name": "Comprehensive R Archive Network (CRAN)",
        "url": "https://cran.r-project.org"
      },
      "sameAs": "https://CRAN.R-project.org/package=sf"
    },
    "15": {
      "@type": "SoftwareApplication",
      "identifier": "zip",
      "name": "zip",
      "provider": {
        "@id": "https://cran.r-project.org",
        "@type": "Organization",
        "name": "Comprehensive R Archive Network (CRAN)",
        "url": "https://cran.r-project.org"
      },
      "sameAs": "https://CRAN.R-project.org/package=zip"
    },
    "16": {
      "@type": "SoftwareApplication",
      "identifier": "fs",
      "name": "fs",
      "provider": {
        "@id": "https://cran.r-project.org",
        "@type": "Organization",
        "name": "Comprehensive R Archive Network (CRAN)",
        "url": "https://cran.r-project.org"
      },
      "sameAs": "https://CRAN.R-project.org/package=fs"
    },
    "17": {
      "@type": "SoftwareApplication",
      "identifier": "tools",
      "name": "tools"
    },
    "SystemRequirements": null
  },
  "fileSize": "943.216KB",
  "releaseNotes": "https://github.com/lgnbhl/BFS/blob/master/NEWS.md",
  "readme": "https://github.com/lgnbhl/BFS/blob/master/README.md",
  "contIntegration": "https://github.com/lgnbhl/BFS/actions/workflows/R-CMD-check.yaml",
  "keywords": [
    "r",
    "r-package",
    "switzerland"
  ]
}

GitHub Events

Total
  • Issues event: 1
  • Watch event: 3
  • Issue comment event: 1
  • Push event: 14
Last Year
  • Issues event: 1
  • Watch event: 3
  • Issue comment event: 1
  • Push event: 14

Committers

Last synced: 12 months ago

All Time
  • Total Commits: 377
  • Total Committers: 10
  • Avg Commits per committer: 37.7
  • Development Distribution Score (DDS): 0.095
Past Year
  • Commits: 31
  • Committers: 2
  • Avg Commits per committer: 15.5
  • Development Distribution Score (DDS): 0.032
Top Committers
Name Email Commits
lgnbhl f****l@p****h 341
Félix Luginbühl f****l@p****m 18
gf-fluginbuhl f****l@t****g 5
FelixAnalytix f****x@g****m 4
JoĂŁo Martins j****s@s****h 4
raphbub-vs 1****s 1
sschmutz s****z@o****m 1
philipp-baumann s****t@p****e 1
Philipp Baumann b****p@p****e 1
FelixAnalytix f****l@g****m 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 9 months ago

All Time
  • Total issues: 13
  • Total pull requests: 6
  • Average time to close issues: 5 months
  • Average time to close pull requests: 8 days
  • Total issue authors: 11
  • Total pull request authors: 4
  • Average comments per issue: 4.85
  • Average comments per pull request: 2.67
  • Merged pull requests: 5
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 2
  • Pull requests: 1
  • Average time to close issues: 4 days
  • Average time to close pull requests: 5 days
  • Issue authors: 2
  • Pull request authors: 1
  • Average comments per issue: 4.5
  • Average comments per pull request: 1.0
  • Merged pull requests: 1
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • lgnbhl (3)
  • JonasPipoz (1)
  • philipp-baumann (1)
  • d-qn (1)
  • mfpa231 (1)
  • Rengervn (1)
  • jmbeoh (1)
  • bttomio (1)
  • lbertela (1)
  • elliotbeck (1)
  • sfirke (1)
Pull Request Authors
  • philipp-baumann (2)
  • sschmutz (2)
  • zambujo (1)
  • raphbub-vs (1)
Top Labels
Issue Labels
bug (2) help wanted (2) enhancement (1)
Pull Request Labels

Packages

  • Total packages: 1
  • Total downloads:
    • cran 669 last-month
  • Total dependent packages: 0
  • Total dependent repositories: 1
  • Total versions: 29
  • Total maintainers: 1
cran.r-project.org: BFS

Get Data from the Swiss Federal Statistical Office

  • Versions: 29
  • Dependent Packages: 0
  • Dependent Repositories: 1
  • Downloads: 669 Last month
Rankings
Forks count: 9.6%
Stargazers count: 13.7%
Average: 20.0%
Dependent repos count: 23.9%
Downloads: 24.0%
Dependent packages count: 28.7%
Last synced: 9 months ago

Dependencies

DESCRIPTION cran
  • R >= 3.0.1 depends
  • janitor * imports
  • jsonlite * imports
  • lifecycle * imports
  • magrittr * imports
  • pxweb * imports
  • rvest * imports
  • tibble * imports
  • tidyRSS * imports
  • xml2 * imports
  • testthat >= 3.0.0 suggests
.github/workflows/R-CMD-check.yaml actions
  • actions/checkout v3 composite
  • r-lib/actions/check-r-package v2 composite
  • r-lib/actions/setup-pandoc v2 composite
  • r-lib/actions/setup-r v2 composite
  • r-lib/actions/setup-r-dependencies v2 composite
.github/workflows/test-coverage.yaml actions
  • actions/checkout v3 composite
  • actions/upload-artifact v3 composite
  • codecov/codecov-action v3 composite
  • r-lib/actions/setup-r v2 composite
  • r-lib/actions/setup-r-dependencies v2 composite