odataR_get_table: Get table data

Description Usage Arguments Value Remarks Examples

View source: R/odataR_code.R

Description

This is the main function of this package. It retrieves a data table from the data base and all dimensions are decoded (if requested). An (optional) query is executed in the database

Usage

1
2
3
4
5
6
7
8
9
odataR_get_table(
  root = NULL,
  table_id = NULL,
  query = NULL,
  typed = T,
  decode = T,
  keepcode = c(),
  debug = F
)

Arguments

root

Character string with root of structure. Default NULL i.e. determined by the last use of odataR_set_root and if never used 'https://opendata.cbs.nl'

table_id

Character string with identification of table

query

OData query to restrict data returned from structure

typed

Boolean indicating 'TypedDataSet' when T or 'UntypedDataSet' when F

decode

Boolean indicating if fields are to be decoded (default T)

keepcode

Character string with dimension(s) for which the coded values are kept

debug

Boolean indicating if (for debugging) the generated OData queries are to be printed (default FALSE)

Value

A tibble (data_frame) when successful otherwise an empty tibble or a message

Remarks

See http://www.odata.org/documentation/odata-version-3-0/odata-version-3-0-core-protocol/ or http://docs.oasis-open.org/odata/odata/v4.0/odata-v4.0-part1-protocol.html (depending on the version of the OData protocol that is used) for details about the query possibilities.

$format=json is forced by the code so do not specify $format=atom because this will not work

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
## Not run: 
df      = odataR_get_table(table_id="82935NED")
df      = odataR_get_table(table_id="82935NED",keepcode = "RegioS")
df      = odataR_get_table(table_id="82935NED",keepcode = c("RegioS","Perioden"))
df      = odataR_get_table(table_id="82935NED",
  query  = paste0("?$filter=startswith(RegioS,'NL01')",
                  "&$select=RegioS,Perioden,TotaleInvesteringen_1",
                  "&$skip=2&$top=3"),
  debug=T)

## End(Not run)

HanOostdijk/odataR documentation built on May 14, 2020, 5:57 p.m.