我有兩個具有相同結構的列表。我想結合它們來產生以下所需的輸出。向列表中的每個子列表添加一個向量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