# NOT RUN {
library(data.table)
inputDT <- as.data.table(data.frame(x = LETTERS[11:20], y = LETTERS[1:10]))
asFactorDT(inputDT, c('x', 'y'))
# }
# NOT RUN {
setRefLevelDT(inputDT)
# }
# NOT RUN {
levels(inputDT$x)[1]
levels(inputDT$y)[1]
setRefLevelDT(inputDT, c('x', 'y'), c('L', 'C'))
levels(inputDT$x)[1]
levels(inputDT$y)[1]
# }
# NOT RUN {
setRefLevelDT(inputDT, c('x', 'y'), c('bla', 'bla'))
# }
# NOT RUN {
inputDT <- as.data.table(data.frame(x = seq(1, 20, 2), y = LETTERS[1:10]))
asFactorDT(inputDT, c('y'))
levels(inputDT$y)[1]
setRefLevelDT(inputDT, 'y', 'E')
levels(inputDT$y)[1]
# }
Run the code above in your browser using DataLab