Skip to content

BFS

Get Data from the Swiss Federal Statistical Office

v0.7.1 · Feb 5, 2026 · GPL (>= 3)

Description

Search and download data from the Swiss Federal Statistical Office (BFS) APIs <https://www.bfs.admin.ch/>.

Downloads

571

Last 30 days

7063rd

2K

Last 90 days

6.8K

Last year

Trend: -34.4% (30d vs prior 30d)

CRAN Check Status

1 ERROR
13 OK
Show all 14 flavors
Flavor Status
r-devel-linux-x86_64-debian-clang OK
r-devel-linux-x86_64-debian-gcc OK
r-devel-linux-x86_64-fedora-clang OK
r-devel-linux-x86_64-fedora-gcc OK
r-devel-macos-arm64 ERROR
r-devel-windows-x86_64 OK
r-oldrel-macos-arm64 OK
r-oldrel-macos-x86_64 OK
r-oldrel-windows-x86_64 OK
r-patched-linux-x86_64 OK
r-release-linux-x86_64 OK
r-release-macos-arm64 OK
r-release-macos-x86_64 OK
r-release-windows-x86_64 OK
Check details (1 non-OK)
ERROR r-devel-macos-arm64

examples

Running examples in ‘BFS-Ex.R’ failed
The error most likely occurred in:

> ### Name: bfs_get_sse_data
> ### Title: Get Data from Swiss Stats Explorer (SSE) API
> ### Aliases: bfs_get_sse_data
> 
> ### ** Examples
> 
> bfs_get_sse_data(
+   number_bfs = "DF_PASTA_552_MONTHLY", 
+   language = "en", 
+   query =  list("FREQ" = "M", "ACCOMMODATION_TYPE" = c("552001"), 
+                 "COUNTRY_ORIGIN" = c("CH", "AUSL")),
+   start_period = "2020",
+   end_period = "2023"
+   )
Error in `httr2::req_perform()`:
! Failed to perform HTTP request.
Caused by error in `curl::curl_fetch_memory()`:
! Timeout was reached [disseminate.stats.swiss]:
Connection timed out after 10002 milliseconds
Backtrace:
    ▆
 1. ├─BFS::bfs_get_sse_data(...)
 2. │ └─BFS:::bfs_get_sse_url(number_bfs)
 3. │   └─... %>% httr2::resp_body_json(simplifyVector = TRUE)
 4. ├─httr2::resp_body_json(., simplifyVector = TRUE)
 5. │ └─httr2:::check_response(resp)
 6. │   └─httr2:::is_response(resp)
 7. └─httr2::req_perform(.)
 8.   └─httr2:::handle_resp(req, resp, error_call = error_call)
 9.     └─rlang::cnd_signal(resp)
Execution halted

Check History

ERROR 13 OK · 0 NOTE · 0 WARNING · 1 ERROR · 0 FAILURE Mar 30, 2026
ERROR r-devel-macos-arm64

examples

Running examples in ‘BFS-Ex.R’ failed
The error most likely occurred in:

> ### Name: bfs_get_sse_data
> ### Title: Get Data from Swiss Stats Explorer (SSE) API
> ### Aliases: bfs_get_sse_data
> 
> ### ** Examples
> 
> bfs_get_sse_data(
+   number_bf
...[truncated]...
ody_json(., simplifyVector = TRUE)
 5. │ └─httr2:::check_response(resp)
 6. │   └─httr2:::is_response(resp)
 7. └─httr2::req_perform(.)
 8.   └─httr2:::handle_resp(req, resp, error_call = error_call)
 9.     └─rlang::cnd_signal(resp)
Execution halted
OK 14 OK · 0 NOTE · 0 WARNING · 0 ERROR · 0 FAILURE Mar 27, 2026
ERROR 12 OK · 0 NOTE · 0 WARNING · 2 ERROR · 0 FAILURE Mar 24, 2026
ERROR r-devel-linux-x86_64-debian-clang

tests

Running ‘testthat.R’ [20s/181s]
Running the tests in ‘tests/testthat.R’ failed.
Complete output:
  > # This file is part of the standard setup for testthat.
  > # It is recommended that you do not modify it.
  > #
  > # Where should you do additional
...[truncated]...
  3.     └─pxweb::pxweb_advanced_get(url = url, query = query, verbose = verbose)
   4.       └─pxweb::pxweb(url)
   5.         └─pxweb:::pxweb_add_config(obj)
  
  [ FAIL 3 | WARN 0 | SKIP 9 | PASS 47 ]
  Error:
  ! Test failures.
  Execution halted
ERROR r-devel-linux-x86_64-debian-gcc

tests

Running ‘testthat.R’ [14s/193s]
Running the tests in ‘tests/testthat.R’ failed.
Complete output:
  > # This file is part of the standard setup for testthat.
  > # It is recommended that you do not modify it.
  > #
  > # Where should you do additional
...[truncated]...
L]])
   14.       │ │     └─base (local) doTryCatch(return(expr), name, parentenv, handler)
   15.       │ └─base::force(expr)
   16.       └─rlang::abort(...)
  
  [ FAIL 1 | WARN 0 | SKIP 9 | PASS 51 ]
  Error:
  ! Test failures.
  Execution halted
OK 14 OK · 0 NOTE · 0 WARNING · 0 ERROR · 0 FAILURE Mar 10, 2026

Dependency Network

Dependencies Reverse dependencies pxweb httr2 xml2 rvest tibble magrittr janitor purrr dplyr curl zip fs lifecycle rlang tidyr BFS

Version History

new 0.7.1 Mar 10, 2026
updated 0.7.1 ← 0.7.0 diff Feb 4, 2026
updated 0.7.0 ← 0.6.0 diff Nov 2, 2025
updated 0.6.0 ← 0.5.13 diff Jun 8, 2025
updated 0.5.13 ← 0.5.12 diff Apr 28, 2025
updated 0.5.12 ← 0.5.11 diff Dec 8, 2024
updated 0.5.11 ← 0.5.10 diff Nov 26, 2024
updated 0.5.10 ← 0.5.9 diff Sep 26, 2024
updated 0.5.9 ← 0.5.8 diff Sep 25, 2024
updated 0.5.8 ← 0.5.7 diff Feb 23, 2024
updated 0.5.7 ← 0.5.6 diff Feb 1, 2024
updated 0.5.6 ← 0.5.5 diff Jan 7, 2024
updated 0.5.5 ← 0.5.4 diff Sep 19, 2023
updated 0.5.4 ← 0.5.3 diff Sep 12, 2023
updated 0.5.3 ← 0.5.2 diff Aug 18, 2023
updated 0.5.2 ← 0.5.1 diff Aug 10, 2023
updated 0.5.1 ← 0.5 diff Jun 8, 2023
updated 0.5 ← 0.4.8 diff Jun 7, 2023
updated 0.4.8 ← 0.4.7 diff May 30, 2023
updated 0.4.7 ← 0.4.6 diff May 18, 2023