我想要cbind
列表中的数据框,而不回收长度较短的项目
library(data.table)
library(dplyr)
library(rlist)
# Create a list of data.tables with unequal lengths
dt1 <- data.table(B = letters[1:3])
dt2 <- data.table( D = LETTERS[1:2])
dt3 <- data.table(F = letters[4:7])
# Put them in a list
dt_list <- list(dt1, dt2, dt3)
# cbind them
dplyr::bind_cols(dt_list)
rlist::list.cbind(dt_list)
更新:预期输出或类似内容
B D F
1 a A d
2 b B e
3 c <NA> f
4 <NA> <NA> g