View source: R/codec_parquet.R
| read_parquet | R Documentation |
Read an Apache Parquet (.parquet) file back to a data frame, restoring the
artoo_meta from its metadata_json sidecar and realizing SAS
date/datetime/time variables to R Date / POSIXct / hms::hms. A
parquet written by another tool (with no artoo sidecar) reads back as a
bare frame. A thin wrapper over read_dataset() with format = "parquet".
Requires the lightweight nanoparquet package.
read_parquet(path, col_select = NULL, n_max = Inf, encoding = NULL)
path |
Source |
col_select |
Variables to read. Note: an unknown name is a |
n_max |
Maximum records to read. |
encoding |
Source charset of the string columns. Tip: any SAS or IANA spelling listed by |
A <data.frame> carrying artoo_meta when the file recorded it
(read it with get_meta()); otherwise a plain data frame.
write_parquet() for the inverse; read_dataset() for the
generic dispatcher.
spec <- artoo_spec(cdisc_adam_datasets, cdisc_adam_variables, codelists = cdisc_codelists)
# ---- Example 1: round-trip a conformed dataset through Parquet ----
#
# The variable labels, types, and keys survive the round-trip.
adsl <- apply_spec(cdisc_adsl, spec, "ADSL", conformance = "off")
path <- tempfile(fileext = ".parquet")
write_parquet(adsl, path)
back <- read_parquet(path)
get_meta(back)@columns$STUDYID$label
# ---- 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.