NB this package (based on XML) is replaced by odataR based on JSON.
This package gives access to information made available with the OData interface.
It is tested on the information from Statistics Netherlands and therefore the root has as default the value http://opendata.cbs.nl .
Another root can be set with the function odataR_set_root .
The most important function is odataR_get_table that downloads for a given table_id the main table and uses its subtables to decode dimensions (as Region
and Periods
). Another important function is odataR_list_tables that
gives an overview of the available tables in data.frame format.
1 df = odataR_get_table(table_id="82935NED")
Convert table 82935NED
to a data.frame with the (two) dimensions (RegioS
and Perioden
) decoded
2 df = odataR_get_table(table_id="82935NED",keepcode = "RegioS")
Same as example1 but the coded version of RegioS
is also included
3 df = odataR_get_table(table_id="82935NED",keepcode = c("RegioS","Perioden"))
Same as example1 but the coded version of both RegioS
and Perioden
are included
4 df = odataR_get_table(table_id="82935NED",keepcode = "RegioS",
query = "?$filter=startswith(RegioS,'NL01')" )
Same as example2 but the OData server will only return rows where the value of RegioS starts with NL01
5 df = odataR_get_table(table_id="82935NED",
query = paste0("?$filter=startswith(RegioS,'NL01')",
"&$select=RegioS,Perioden,TotaleInvesteringen_1") )
Same as example4 but the OData server will only return the indicated fields (columns)
6 df = odataR_get_table(table_id="82935NED",
query = paste0("?$filter=startswith(RegioS,'NL01')",
"&$select=RegioS,Perioden,TotaleInvesteringen_1",
"&$skip=2&$top=3") )
Same as example5 but the OData server will only return the third, fourth and fifth row
The $filter
, $select
, $skip
and $top
commands used in the examples 4 and further are elements of the query language for OData described in the OData protocol v4 for version 4 and the OData protocol v3 for version 3. The website of Statistics Netherlands uses version 3.
The folder private contains two PDFs with extra information:
install.packages("devtools") library(devtools) install_github("HanOostdijk/odataR")
To my knowledge two other packages concerning OData exist:
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.