R/get-table-list.R

Defines functions get_table_list

Documented in get_table_list

#' Retrieve a data.frame with requested cbs tables
#' 
#' This method is deprecated in favor of [cbs_get_toc()].
#' 
#' @param ... filter statement to select rows, e.g. Language="nl"
#' @param select `character` columns to be returned, by default all columns
#' will be returned.
#' @param base_url optionally specify a different server. Useful for
#' third party data services implementing the same protocal.
#' @return `data.frame` with identifiers, titles and descriptions of tables
#' @importFrom whisker whisker.render
#' @importFrom jsonlite fromJSON
#' @export
#' @examples 
#' \dontrun{
#' 
#' # get list of english tables
#' tables_en <- get_table_list(Language="en")
#'
#' # get list of dutch tables
#' tables_nl <- get_table_list(Language="nl")
#' View(tables_nl)
#' }
get_table_list <- function( ..., select=NULL
                          , base_url = getOption("cbsodataR.base_url", BASE_URL)
                          ){
  .Deprecated("cbs_get_toc")
  url <- whisker.render("{{BASEURL}}/{{CATALOG}}/Tables?$format=json"
                       , list( BASEURL = base_url
                             , CATALOG = CATALOG
                             )
                       )
  url <- paste0(url, get_query(..., select = select))
  
  tables <- resolve_resource(url, "Retrieving tables from")
  tables
}

Try the cbsodataR package in your browser

Any scripts or data that you put into this service are public.

cbsodataR documentation built on Jan. 13, 2021, 7:30 p.m.