我想知道一种允许对列表的数值求和(或计算平均值)的优雅方法。例如
x <- list( a = matrix(c(1,2,3,4), nc=2), b = matrix(1, nc=2, nr=2))
想要得到
x[[1]]+x[[2]]
或平均值:
(x[[1]]+x[[2]])/2
相关分类