Statistics Netherlands (CBS) Open Data API Client

The data and meta data from Statistics Netherlands (www.cbs.nl) can be browsed and downloaded. The client uses the open data API of Statistics Netherlands.


the url of the CBS Open Data api will change from "http" to "https"

cbsodataR version 2.4 and later will use https by default.

version downloads Travis-CI Build Status AppVeyor Build Status

Retrieve data from the open data interface (dutch) of Statistics Netherlands (cbs.nl) with R.

Python user? Use cbsodata.

Installation

From CRAN

install.packages("cbsodataR")

The latest development version of cbsodata can installed using devtools.

devtools::install_github("edwindj/cbsodataR")

Usage

Retrieve list a tables.

Use the Identifier from tables to retrieve table information

> get_meta('71509ENG')
 
71509ENG: 'Yield apples and pears', 2013
  FruitFarmingRegions: 'Fruit farming regions'
  Periods: 'Periods' 

Or download data

> library(dplyr) # to help select data and use the %>% operator
> get_data('71509ENG') %>% select(2:5) %>% head

Source: local data frame [6 x 4]

  FruitFarmingRegions Periods TotalAppleVarieties_1 CoxSOrangePippin_2
1   Total Netherlands    1997                   420                 43
2   Total Netherlands    1998                   518                 40
3   Total Netherlands    1999                   568                 39
4   Total Netherlands    2000                   461                 27
5   Total Netherlands    2001                   408                 30
6   Total Netherlands    2002                   354                 17

News

version 0.3.2

  • Added a new function cbs_get_data_from_link to allow for retrieving data using a link created with the opendata portal. Thanks to Albert Pieters for the suggestion
  • Improved the base_url default value.
  • fixed a bug in cbs_get_data, key columns were not always loaded as character columns (issue #15). Thanks to @VincentKars

version 0.3.1

  • removed httr and changed to jsonlite::read_json. httr gave problems with some Windows configurations.
  • fixed cbs_get_toc with select argument (issue #12). Thanks to Rob van Harrevelt.

version 0.3

  • changed api: all (new) functions are prefixed with cbs_ to have a more clean programming interface.
  • old functions are still available and working but are deprecated.
  • verbose=FALSE and cache=TRUE by default: (for new functions).
  • get_table_list renamed to cbs_get_toc
  • data by default is typed: converted to the numeric representation (was not the case)
  • data is not recoded anymore, but label columns can be added to the data set by using cbs_add_label_columns.
  • View shows the column title.
  • cbs_add_date_column adds a column with the period converted to Date or numeric.

version 0.2.3

  • added with strip.whitespace to get_data (issue #4), suggestion of Jonathan de Bruin
  • changed address of opendata to https variant.

version 0.2.2

  • used httr: better performance and error handling of failed connections.
  • add get_tables_themes : suggestion of Wietse Dol.

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.

install.packages("cbsodataR")

0.3.2 by Edwin de Jonge, 3 months ago


https://github.com/edwindj/cbsodataR


Report a bug at https://github.com/edwindj/cbsodataR/issues


Browse source code at https://github.com/cran/cbsodataR


Authors: Edwin de Jonge [aut, cre]


Documentation:   PDF Manual  


Task views: Official Statistics & Survey Methodology


GPL-2 license


Imports whisker, jsonlite, utils

Suggests knitr, rmarkdown, dplyr, shiny


See at CRAN