reorder_levels_params.Rd
Reorder PARAM and PARAMCD Levels Simultaneously
reorder_levels_params(df, paramcd_levels)
data.frame with PARAM and PARAMCD variables
ordered levels of PARAMCD
df <- data.frame(PARAMCD = factor(c("A", "B", "C")), PARAM = factor(paste("letter", LETTERS[1:3])))
str(reorder_levels_params(df, paramcd_levels = c("B", "A", "C")))
#> 'data.frame': 3 obs. of 2 variables:
#> $ PARAMCD: Factor w/ 3 levels "B","A","C": 1 2 3
#> $ PARAM : Factor w/ 3 levels "letter B","letter A",..: 1 2 3
str(reorder_levels_params(df, paramcd_levels = c("B", "A")))
#> 'data.frame': 3 obs. of 2 variables:
#> $ PARAMCD: Factor w/ 3 levels "B","A","C": 1 2 3
#> $ PARAM : Factor w/ 3 levels "letter B","letter A",..: 1 2 3