odataR_get_meta: Get meta data about table

Description Usage Arguments Value Remarks Examples

View source: R/odataR_code.R

Description

This function can be used to get information about an OData table.

Usage

1
2
3
4
5
6
7
odataR_get_meta(
  root = NULL,
  table_id = NULL,
  metatype = NULL,
  query = NULL,
  debug = FALSE
)

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

Identification of table

metatype

indicates the type of metadata that will be retrieved. Possible values are:

  • NULL or empty : a tibble with the urls of the subtables will be retrieved

  • 'TableInfos' : a tibble with one row is retrieved with (background) information about the table

  • 'CategoryGroups' : a tibble with one row is retrieved with information about the category tables for this table

  • 'DataProperties' : a tibble is retrieved with information about the columns of the table

  • a dimension name : a tibble is retrieved with the code information of the dimension (e.g. Gemeenten in the examples below).

query

OData query to restrict data returned from the meta table (do not use in combination with metatype=NULL)

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
12
13
14
15
## Not run: 
odataR_set_root('http://dataderden.cbs.nl') 
# NB statement in previous line is necessary
#  otherwise the examples below will not work!
df = odataR_get_meta(table_id='45042NED')
df = odataR_get_meta(table_id='45042NED',metatype='TableInfos')
df = odataR_get_meta(table_id='45042NED',metatype='CategoryGroups')
df = odataR_get_meta(table_id='45042NED',metatype='DataProperties')
df = odataR_get_meta(table_id='45042NED',metatype='Gemeenten')
df = odataR_get_meta(table_id='45042NED',metatype='Verslagsoort')
df = odataR_get_meta(table_id='45042NED',metatype='Gemeenten',
       query="?$filter=substringof('amstelveen',tolower(Title))",
       debug=T)

## End(Not run)

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