-
-
Save tengpeng/15a08d6375422bd87190 to your computer and use it in GitHub Desktop.
convert all col to factor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # To do it for all names | |
| col_names <- names(df_all) | |
| # do do it for some names in a vector named 'col_names' | |
| df_all[,col_names] <- lapply(df_all[,col_names] , factor) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment