组合R中列表的等长矢量

时间:2018-04-18 19:50:14

标签: r list vector cbind

我有一个不同向量长度的列表:

 [[1]]
 X1  X2 
"N" "N" 

[[2]]
 X1  X2 
"N" "C" 

[[3]]
 X1  X2 
"S" "S" 

[[4]]
 X1  X2  X3 
"S" "S" "U" 

[[5]]
NULL

[[6]]
 X1  X2 
"S" "N" 

[[7]]
 X1  X2  X3 
"S" "S" "S" 

[[8]]
 X1  X2 
"S" "N" 

[[9]]
 X1  X2  X3  X4  X5  X6 
"F" "S" "S" "S" "N" "C" 

我想要完成的是将等长度向量组合在一起,就像这样,对于3个长度向量:

   [,1] [,2] 
X1 "S"  "S"  
X2 "S"  "S"  
X3 "U"  "S"

其他长度向量也是如此,例如2:

 [,1] [,2] [,3] [,4] [,5]
X1 "N"  "N"  "S"  "S"  "S"
X2 "N"  "C"  "S"  "N"  "N"

提前谢谢。

0 个答案:

没有答案