Learn R Programming

R2DT (version 0.2)

detectWeirdLevelNamesDT: Detecting which levels of which factor of a data.table object contain non-alpha numeric characters (including whitespace) characters

Description

Detecting which levels of which factor of a data.table object contain non-alpha numeric characters (including whitespace) characters

Usage

detectWeirdLevelNamesDT(inputDT)

Arguments

inputDT

data.table object containing the data of interest. This is an obligatory argument, without default value.

Value

No value is returned. Note that a valid value needs to be supplied to the 'colNamesToBeChecked' argument in order to make this function work.

Examples

Run this code
# NOT RUN {
library(data.table)
inputDT <- as.data.table(data.frame(x = seq(1, 20, 2)))
detectWeirdLevelNamesDT(inputDT)

inputDT <- as.data.table(data.frame(x = seq(1, 20, 2), y = LETTERS[1:10]))
asFactorDT(inputDT, c('y'))
detectWeirdLevelNamesDT(inputDT)

inputDT <- as.data.table(data.frame(x = c(rep('test_', 5), rep('test@', 5)),
y = c(rep('test_', 5), rep('test@', 5))))
asFactorDT(inputDT, c('x', 'y'))
# }
# NOT RUN {
detectWeirdLevelNamesDT(inputDT)
# }

Run the code above in your browser using DataLab