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

View source: R/utils_data.table.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

Value

Nothing, modifies x in-place.

Author(s)

EDG

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 June 14, 2025, 11:54 p.m.