Skip to contents

Read published data

Usage

read_data(
  id = NULL,
  parse_datetime = TRUE,
  unique_keys = FALSE,
  from = NULL,
  format = "new"
)

Arguments

id

(character) Identifier of dataset to read. Identifiers are listed in the "id" column of the search_data() output. Older versions of datasets can be read, but a warning is issued.

parse_datetime

(logical) Parse datetime values if TRUE, otherwise return as character strings.

unique_keys

(logical) Whether to create globally unique primary keys (and associated foreign keys). Useful in maintaining referential integrity when working with multiple datasets. If TRUE, id is appended to each table's primary key and associated foreign key. Default is FALSE.

from

(character) Full path of file to be read (if .rds), or path to directory containing saved datasets (if .csv).

format

(character) Format of returned object, which can be: "new" (the new implementation) or "old" (the original implementation; deprecated). In the new format, the top most level of nesting containing the "id" field has been moved to the same level as the "tables", "metadata", and "validation_issues" fields.

Value

(list) A dataset with the structure:

  • id - Dataset identifier

  • metadata - List of info about the dataset. NOTE: This object is underdevelopment and content may change in future releases.

  • tables - List of dataset tables as data.frames.

  • validation_issues - List of validation issues. If the dataset fails any validation checks, then descriptions of each issue are listed here.

Details

Validation checks are applied to each dataset ensuring it complies with the hymetDP model. A warning is issued when any validation checks fail. All datasets are returned, even if they fail validation.

Column classes are coerced to those defined in the hymetDP specification.

Validation happens each time files are read, from source APIs or local environments.

Note

This function may not work between 01:00 - 03:00 UTC on Wednesdays due to regular maintenance of the EDI Data Repository.