View source: R/spec_accessors.R
| spec_keys | R Documentation |
Parse a dataset's sort keys into a character vector of variable names.
These keys drive the sort step of apply_spec() and the keySequence
written to each output format.
spec_keys(spec, dataset)
spec |
The specification to read. |
dataset |
The dataset whose keys to parse. Restriction: must name a dataset in the spec. |
A character vector of key variable names, split from the
dataset's keys cell (whitespace- or comma-separated). Empty when no
keys are declared.
spec_datasets() for the dataset names; spec_variables() for
the variables a key must reference.
# ---- Example 1: parse a dataset's sort keys ----
#
# Declare DM's keys, then read them back as the ordered vector apply_spec()
# sorts by. (STUDYID and USUBJID are real DM variables in the demo data.)
ds <- cdisc_sdtm_datasets
ds$keys[ds$dataset == "DM"] <- "STUDYID USUBJID"
spec <- artoo_spec(ds, cdisc_sdtm_variables, codelists = cdisc_codelists)
spec_keys(spec, "DM")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.