cso_get_toc: Returns a data frame with all valid CSO PxStat tables listed...

View source: R/cso_get_toc.R

cso_get_tocR Documentation

Returns a data frame with all valid CSO PxStat tables listed sequentially by id number, e.g. A0101, A0102, A0103, etc.

Description

Checks the CSO PxStat API for a list of all the table codes (e.g. A0101, A0102, A0103, etc.), which also includes date last modified and title for each table, and returns this list as an R data frame.

Usage

cso_get_toc(
  cache = TRUE,
  suppress_messages = FALSE,
  get_frequency = FALSE,
  list_vars = FALSE,
  flush_cache = TRUE,
  from_date = lubridate::date(lubridate::today() - lubridate::years(2))
)

Arguments

cache

logical. If TRUE (default) the table of contents is cached with the system date as a key.

suppress_messages

logical. If FALSE (default) a message is printed when loading a previously cached table of contents.

get_frequency

logical. If TRUE the frequency of each table(yearly, monthly etc...) will be returned as an additional column in the table of contents.

list_vars

logical. If TRUE an additional column will be added to the table of contents which lists each tables variables.

flush_cache

logical. If TRUE (default) the cache will be checked for old, unused files. Any files which have not been accessed in the last month will be deleted.

from_date

date in the format YYYY-MM-DD or Null. Will only return tables last modified after date provided. Default is 2 years from current date.

Details

The data is pulled from the ReadCollection on the CSO API. See https://github.com/CSOIreland/PxStat/wiki/API-Cube-RESTful for more information on this.

Value

data frame of three character columns:

  • id. Contains all of the table codes currently available on the CSO API.

  • LastModified. The date the table was last modified in POSIXct format.

  • title. The title of the table.

Examples

## Not run: 
head(cso_get_toc())

## End(Not run)

csodata documentation built on Aug. 11, 2023, 5:08 p.m.