dt_set_cleanfactorlevels | R Documentation |
Finds all factors in a data.table and cleans factor levels to include only underscore symbols
dt_set_cleanfactorlevels(x, prefix_digits = NA)
x |
data.table |
prefix_digits |
Character: If not NA, add this prefix to all factor levels that are numbers |
E.D. Gennatas
## Not run:
x <- as.data.table(iris)
levels(x$Species) <- c("setosa:iris", "versicolor$iris", "virginica iris")
dt_set_cleanfactorlevels(x)
x
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.