varN_fctr_reorder: Re-order Factor Levels by VARN

varN_fctr_reorderR 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)

Biogen-Inc/tidyCDISC documentation built on April 22, 2023, 2:12 p.m.