get_data: Get data from a resource.

View source: R/get_data.R

get_dataR Documentation

Get data from a resource.

Description

Get data from a resource in tabular format with the option to select fields and perform basic filtering. Where multiple data sets are required from a package and/or no field selection and filtering is required the get_resource function can be used.

Usage

get_data(resource, fields = NULL, limit = NULL, where = NULL, page_size = NULL)

Arguments

resource

A character string containing the resource id of the data set to be returned.

fields

A character vector containing the names of fields to be included in the returned table. The input is checked to ensure the specified fields exist in the chosen resource.

limit

An integer specifying the maximum number of records to be returned, the default NULL value returns all records.

where

A character string containing the 'WHERE' element of a simple SQL SELECT style query. Field names must be double quoted ", non-numeric values must be single quoted ', and both single and double quotes must be delimited. Example; where = "\"AgeGroup\" = \'45-49 years\'".

page_size

An integer specifying the maximum number of records to be returned per query. Setting a value causes the use of offset pagination, multiple queries will be sent to return subsets of the available data. Subsets are joined before being returned. The default NULL value will always attempt to return all rows with a single query.

Value

A data.frame.

Examples

## Not run: 
get_data(resource = "edee9731-daf7-4e0d-b525-e4c1469b8f69")

get_data(
  resource = "edee9731-daf7-4e0d-b525-e4c1469b8f69",
  fields = c("AgeGroup", "EuropeanStandardPopulation"),
  where = "\"AgeGroup\" = \'45-49 years\'"
)

## End(Not run)


odns documentation built on Nov. 10, 2022, 5:56 p.m.