Assigns dataset label from a dataset level metadata to a given data frame. This is stored in the 'label' attribute of the dataframe.
Metadata
The argument passed in the 'metadata' argument can either be a metacore object, or a data.frame containing the data listed below. If metacore is used, no changes to options are required.
For data.frame 'metadata' arguments two columns must be present:
Domain Name - passed as the 'xportr.df_domain_name' option. Default: "dataset". This is the column subset by the 'domain' argument in the function.
Label Name - passed as the 'xportr.df_label' option. Default: "label". Character values to update the 'label' attribute of the dataframe This is passed to
haven::write_xpt
to note the label.
Examples
adsl <- data.frame(
USUBJID = c(1001, 1002, 1003),
SITEID = c(001, 002, 003),
AGE = c(63, 35, 27),
SEX = c("M", "F", "M")
)
metadata <- data.frame(
dataset = c("adsl", "adae"),
label = c("Subject-Level Analysis", "Adverse Events Analysis")
)
adsl <- xportr_df_label(adsl, metadata, domain = "adsl")