I have some data.tables that I would like rbindlist . Tables contain factors with (possibly missing) levels. Then rbindlist(...) behaves differently than do.call(rbind(...)) :
dt1 <- data.table(x=factor(c("a", "b"), levels=letters)) rbindlist(list(dt1, dt1))[,x] ## [1] abab ## Levels: ab do.call(rbind, list(dt1, dt1))[,x] ## [1] abab ## Levels: abcdefghijklmnopqrstu vwxyz
If I want to keep levels, can I turn to rbind or is there a data.table way?
source share