Align Sex Coding in Data Frame
align_sex_coding_in_df.RdThis function aligns the sex coding in a data frame by detecting how the sex variable is coded ('Male/Female', 'M/F', or '0(Male)/1(Female)') and converting them to 1/2.
Examples
data <- data.frame(sex = c("Male", "Female", "Male"), age = c(25, 30, 35))
align_sex_coding_in_df(data)
#> sex age
#> 1 1 25
#> 2 2 30
#> 3 1 35