| read_dataset | R Documentation |
Read a clinical file back to a data frame, restoring its artoo_meta. The
codec is chosen from the file extension (or an explicit format), and the
metadata the file carries is re-attached, so a value written by
write_dataset() round-trips losslessly. This is the ingest end of the
I/O layer; the per-format wrappers like read_rds() call it.
read_dataset(path, format = NULL, col_select = NULL, n_max = Inf, ...)
path |
Source file path. |
format |
Force a codec instead of inferring from the extension.
|
col_select |
Variables to read. Note: an unknown name is a |
n_max |
Maximum records to read. |
... |
Codec-specific arguments passed through to the decoder (see
the per-format wrappers, e.g. |
A <data.frame> carrying artoo_meta when the file recorded it
(read it with get_meta()). A file whose payload is not a data frame is
a artoo_error_codec.
write_dataset() for the inverse; read_rds() for the
per-format wrapper.
spec <- artoo_spec(cdisc_adam_datasets, cdisc_adam_variables, codelists = cdisc_codelists)
# ---- Example 1: round-trip a dataset through rds ----
#
# Write a conformed dataset, then read it back; the metadata survives.
adsl <- apply_spec(cdisc_adsl, spec, "ADSL", conformance = "off")
path <- tempfile(fileext = ".rds")
write_dataset(adsl, path)
back <- read_dataset(path)
identical(get_meta(back)@columns, get_meta(adsl)@columns)
# ---- Example 2: the metadata names the dataset and row count ----
#
# The restored artoo_meta exposes the dataset-level attributes.
get_meta(back)@dataset$records
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.