rbindlist data.tables z różną liczbą kolumn
Zastanawiam się, jak mogę zindeksować tabele danych o różnej liczbie kolumn i wypełnić puste wiersze za pomocą NA, takich jak rbind.fill
DT1 <- data.table(A = 1:3)
DT2 <- data.table(A =4:5, B = letters[4:5])
l <- list(DT1, DT2)
rbindlist(l)
# Error in rbindlist(l) :
# Item 2 has 2 columns, inconsistent with item 1 which has 1 columns
Chcę to uzyskać
A B
1: 1 NA
2: 2 NA
3: 3 NA
4: 4 d
5: 5 e