rel_var | R Documentation |
Assign values to a related variable within a domain.
rel_var(df, var_name, related_var, var_values = NULL)
df |
( |
var_name |
( |
related_var |
( |
var_values |
( |
df
with added factor variable var_name
containing var_values
corresponding to related_var
.
# 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"
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.