varN_fctr_reorder {tidyCDISC}R Documentation

Re-order Factor Levels by VARN

Description

Function to that looks for VARN counterparts to any character or factor VAR variables in any dataframe and re-orders there factor levels, taking the lead from VARN's numeric guide.

Usage

varN_fctr_reorder(data)

Arguments

data

a dataframe, including one enriched with SAS labels attributes

Value

The data frame after having factor levels re-ordered by VARN

Examples

data(adae, package = "tidyCDISC")

varN_fctr_adae <- varN_fctr_reorder(adae)

unique(adae[,c("AGEGR1", "AGEGR1N")])
levels(adae$AGEGR1)
levels(varN_fctr_adae$AGEGR1)

unique(adae[,c("RACE", "RACEN")])
levels(adae$RACE)
levels(varN_fctr_adae$RACE)

[Package tidyCDISC version 0.2.1 Index]