| write_rds | R Documentation |
Write a data frame to an R .rds file, preserving its artoo_meta. A thin
wrapper over write_dataset() with format = "rds"; the rds carries the
metadata both as live R attributes and as the language-agnostic
metadata_json string, so read_rds() restores it exactly.
write_rds(x, path, encoding = NULL)
x |
The dataset to write. |
path |
Destination |
encoding |
Source charset to record. Tip: any SAS or IANA spelling listed by |
The input x, invisibly, so a write can sit mid-pipeline.
read_rds() for the inverse; write_dataset() for the generic
dispatcher.
spec <- artoo_spec(cdisc_adam_datasets, cdisc_adam_variables, codelists = cdisc_codelists)
# ---- Example 1: write a conformed dataset to rds ----
#
# apply_spec() attaches the metadata; write_rds() carries it into the file.
adsl <- apply_spec(cdisc_adsl, spec, "ADSL", conformance = "off")
path <- tempfile(fileext = ".rds")
write_rds(adsl, path)
# ---- Example 2: round-trip and confirm the metadata survived ----
#
# Reading it back yields an identical artoo_meta.
back <- read_rds(path)
identical(get_meta(back)@columns, get_meta(adsl)@columns)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.