assign_meta_data | R Documentation |
Trims the length of each text and date variable to the length specified in
the spec and then assigns the attributes "label"
and "width"
to each
column.
assign_meta_data(
tbl,
spec,
datatype_col = "Data Type",
var_col = "Variable",
length_col = "Length",
label_col = "Label"
)
tbl |
a data frame containing a SDTM table |
spec |
a data frame with the columns |
datatype_col |
a string, the column in |
var_col |
a string, the column in |
length_col |
a string, the column in |
label_col |
a string, the column in |
a modified copy of tbl
with the meta data per specification
get_data_spec()
, get_key_vars()
, get_codelist()
work_dir <- system.file("extdata", package = "sdtmval")
spec <- get_data_spec(domain = "XX",
dir = work_dir,
filename = "spec.xlsx")
after_meta_data <- assign_meta_data(sdtmval::xx_no_meta_data, spec = spec)
labels <- colnames(after_meta_data) |>
purrr::map(~ attr(after_meta_data[[.]], "label")) |>
unlist()
lengths <- colnames(after_meta_data) |>
purrr::map(~ attr(after_meta_data[[.]], "width")) |>
unlist()
data.frame(
column = colnames(after_meta_data),
labels = labels,
lengths = lengths
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.