derive_seq | R Documentation |
--SEQ
) variablederive_seq()
creates a new identifier variable: the sequence number
(--SEQ
).
This function adds a newly derived variable to tgt_dat
, namely the sequence
number (--SEQ
) whose name is the one provided in tgt_var
. An integer
sequence is generated that uniquely identifies each record within the domain.
Prior to the derivation of tgt_var
, the data frame tgt_dat
is sorted
according to grouping variables indicated in rec_vars
.
derive_seq(
tgt_dat,
tgt_var,
rec_vars,
sbj_vars = sdtm.oak::sbj_vars(),
start_at = 1L
)
tgt_dat |
The target dataset, a data frame. |
tgt_var |
The target SDTM variable: a single string indicating the name
of the sequence number ( |
rec_vars |
A character vector of record-level identifier variables. |
sbj_vars |
A character vector of subject-level identifier variables. |
start_at |
The sequence numbering starts at this value (default is |
Returns the data frame supplied in tgt_dat
with the newly derived
variable, i.e. the sequence number (--SEQ
), whose name is that passed in
tgt_var
. This variable is of type integer.
# A VS raw data set example
(vs <- read_domain_example("vs"))
# Derivation of VSSEQ
rec_vars <- c("STUDYID", "USUBJID", "VSTESTCD", "VSDTC", "VSTPTNUM")
derive_seq(tgt_dat = vs, tgt_var = "VSSEQ", rec_vars = rec_vars)
# An APSC raw data set example
(apsc <- read_domain_example("apsc"))
# Derivation of APSEQ
derive_seq(
tgt_dat = apsc,
tgt_var = "APSEQ",
rec_vars = c("STUDYID", "RSUBJID", "SCTESTCD"),
sbj_vars = c("STUDYID", "RSUBJID")
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.