Answers for "how to convert all columns of a dataframe into factors in r"

1

how to convert all columns of a dataframe into factors in r

DF[sapply(DF, is.character)] <- lapply(DF[sapply(DF, is.character)], 
                                       as.factor)
Posted by: Guest on September-26-2021

Code answers related to "how to convert all columns of a dataframe into factors in r"

Browse Popular Code Answers by Language