我有两个具有相同结构的列表。我想结合它们来产生以下所需的输出。向列表中的每个子列表添加一个向量R
A <- list(c(1,2,3,2,1,4),c(7,3,1,2,2,1),c(2,3,7,2,2,8))
B <- list(c(2,1,3,2),c(3,1,5,2),c(2,4,5,1))
# Desired Output
[[1]]
[1] 1 2 3 2 1 4
[1] 2 1 3 2
[[2]]
[1] 7 3 1 2 2 1
[1] 3 1 5 2
[[3]]
[1] 2 3 7 2 2 8
[1] 2 4 5 1
# I have tried with the items beloww and nothing works as to produce the shown desired output. Would you happen to know on how to combine the two vectors as to produce the outcome below.
c
cbind(A,B)
A B
[1,] Numeric,6 Numeric,4
[2,] Numeric,6 Numeric,4
[3,] Numeric,6 Numeric,4
merge
append
你可以有'地图(列表中,A,B)'作为“A”和“B”的对应元素不同的长度 – akrun
不知道你可以在函数外使用map函数并产生预期的输出 – Barnaby
这是预期的输出吗? – akrun