dt_set_cleanfactorlevels: Clean factor levels of data.table in-place

View source: R/dt_ops.R

dt_set_cleanfactorlevelsR Documentation

Clean factor levels of data.table in-place

Description

Finds all factors in a data.table and cleans factor levels to include only underscore symbols

Usage

dt_set_cleanfactorlevels(x, prefix_digits = NA)

Arguments

x

data.table

prefix_digits

Character: If not NA, add this prefix to all factor levels that are numbers

Author(s)

E.D. Gennatas

Examples

## 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)

egenn/rtemis documentation built on Oct. 28, 2024, 6:30 a.m.