# Example with data.frame.
params <- c("Level A", "Level B", "Level C")
adlb_df <- data.frame(
ID = 1:9,
PARAM = factor(
rep(c("Level A", "Level B", "Level C"), 3),
levels = params
)
)
rel_var(
df = adlb_df,
var_name = "PARAMCD",
var_values = c("A", "B", "C"),
related_var = "PARAM"
)
# Example with tibble.
adlb_tbl <- tibble::tibble(
ID = 1:9,
PARAM = factor(
rep(c("Level A", "Level B", "Level C"), 3),
levels = params
)
)
rel_var(
df = adlb_tbl,
var_name = "PARAMCD",
var_values = c("A", "B", "C"),
related_var = "PARAM"
)
Run the code above in your browser using DataLab