-
Notifications
You must be signed in to change notification settings - Fork 1k
Closed
Description
Hello,
Rbindlist doesn't accept both use.names = FALSE and fill = TRUE, it automatically changes use.names = TRUE, which is not my desired behaviour. I would like
| x | y |
|---|---|
| 1 | A |
bound with
| z |
|---|
| 4 |
to give
| x | y |
|---|---|
| 1 | A |
| 4 | NA |
library(data.table)
l1 <- list(data.table(x = 1, y = "A"), data.table(z = 4))
l1
# what I want
data.table(x = c(1,4), y = c("A", NA))
rbindlist(l1, fill = T) # works but 3 columns
rbindlist(l1, use.names = FALSE) # doesn't work :
# Item 2 has 1 columns,
# inconsistent with item 1 which has 2 columns.
# To fill missing columns use fill=TRUE
rbindlist(l1, use.names = FALSE, fill = TRUE) # back to case 1
# use.names= cannot be FALSE when fill is TRUE. Setting use.names=TRUE.
The warning after rbindlist(l1, use.names = FALSE) recommending to add fill = TRUE is misleading because then it won't work.
avimallu
Metadata
Metadata
Assignees
Labels
No labels