Join adsub
to adsl
join_adsub_adsl.Rd
Join adsub
to adsl
Usage
join_adsub_adsl(
adam_db,
keys = c("USUBJID", "STUDYID"),
continuous_var = "all",
categorical_var = "all",
continuous_suffix = "",
categorical_suffix = "_CAT"
)
Arguments
- adam_db
(
dm
) object input with anadsl
andadsub
table.- keys
(
character
) the name of the columns inadsl
uniquely identifying a row.- continuous_var
(
character
) the value of a parameter in thePARAMCD
column of theadsub
table from which columns containing continuous values should be created. If"all"
, all parameter values are selected, ifNULL
, none are selected.- categorical_var
(
character
) the value of a parameter in thePARAMCD
column of theadsub
table from which columns containing categorical values should be created. If"all"
, all parameter values are selected, ifNULL
, none are selected.- continuous_suffix
(
string
) the suffixes to add to the newly generated columns containing continuous values.- categorical_suffix
(
string
) the suffixes to add to the newly generated columns containing categorical values.
Examples
adsl <- data.frame(
USUBJID = c("S1", "S2", "S3", "S4"),
STUDYID = "My_study",
AGE = c(60, 44, 23, 31)
)
adsub <- data.frame(
USUBJID = c("S1", "S2", "S3", "S4", "S1", "S2", "S3"),
STUDYID = "My_study",
PARAM = c("weight", "weight", "weight", "weight", "height", "height", "height"),
PARAMCD = c("w", "w", "w", "w", "h", "h", "h"),
AVAL = c(98, 75, 70, 71, 182, 155, 152),
AVALC = c(">80", "<=80", "<=80", "<=80", ">180", "<=180", "<=180")
)
db <- dm::dm(adsl, adsub)
db <- dm::dm_add_pk(db, adsl, STUDYID)
db <- dm::dm_add_fk(db, adsub, STUDYID, adsl)
x <- join_adsub_adsl(adam_db = db)
x <- join_adsub_adsl(adam_db = db, continuous_var = c("w", "h"), categorical_var = "h")