Learn R Programming

cbsodataR (version 0.3)

cbs_get_data: Get data from Statistics Netherlands (CBS)

Description

Retrieves data from a table of Statistics Netherlands. A list of available tables can be retrieved with cbs_get_toc. Use the Identifier column of cbs_get_toc as id in cbs_get_data and cbs_get_meta. Optionaly the data can be filtered on category values. The filter is specified with <column_name> = <values> in which <values> is a character vector. Rows with values that are not part of the character vector are not returned. Note that the values have to be raw (un-recoded) values.

Usage

cbs_get_data(id, ..., select = NULL, typed = TRUE,
  add_column_labels = TRUE, dir = tempdir(), verbose = FALSE,
  base_url = CBSOPENDATA, include_ID = FALSE)

Arguments

id

Identifier of table, can be found in cbs_get_toc

...

optional filter statements

select

character optional, columns to select

typed

Should the data automatically be converted into integer and numeric?

add_column_labels

Should column titles be added as a label (TRUE) which are visible in View

dir

Directory where the table should be downloaded. Defaults to temporary directory

verbose

Print extra messages what is happening.

base_url

optionally specify a different server. Useful for third party data services implementing the same protocol.

include_ID

Should the data include the ID column for the rows?

Value

data.frame with the requested data. Note that a csv copy of the data is stored in dir.

Details

By default the columns will be converted to their type (typed=TRUE). CBS uses multiple types of missing (unknown, surpressed, not measured, missing): users wanting all these nuances can use typed=FALSE which results in character columns.

See Also

cbs_get_meta, cbs_download_data

Examples

Run this code
# NOT RUN {
# get data for main (000000) Consumer Price Index (7196ENG) for March 2000, 
 cbs_get_data(id="7196ENG", Periods="2000MM03", CPI="000000")
# }

Run the code above in your browser using DataLab