char2fac | R Documentation |
Convert all character columns in a data frame to factors. Author: Bryce Chamberlain.
char2fac(x, sortlevels = FALSE, na_level = "(Missing)")
x |
Data frame to modify. |
sortlevels |
Choose whether to sort levels. This is the default R behavior and is therefore likely faster, but it may change the order of the data and this can be problematic so the default is FALSE. |
na_level |
some functions don't like factors to have NAs so we replace NAs with this value for factors only. Set NULL to skip. |
Data frame with converted factors.
char2fac( iris )
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.