假设您有一个向量列表:
L = list()
L[[1]]= c(2,34,6,7,3)
L[[2]]= c(3,4,6,8,1)
names(L[[1]])=c("A","B","C","D","E")
names(L[[2]])=c("A","R","C","D","F")
L
## [[1]]
## A B C D E
## 2 34 6 7 3
##
## [[2]]
## A R C D F
## 3 4 6 8 1
我想按每个元素的名称对 2 个向量求和...结果:
A B C D E F R
5 34 12 15 3 1 4
谢谢