R中是否有任何快速方法或内置函数来计算基于第三维的平均值?
例如我的数组是:
, , 1
[,1] [,2]
[1,] 1 3
[2,] 2 4
, , 2
[,1] [,2]
[1,] 11 13
[2,] 12 14
, , 3
[,1] [,2]
[1,] 21 23
[2,] 22 24
我的输出是:
[,1] [,2]
[1,] mean(1,11,21) mean(3,13,23)
[2,] mean(2,12,22) mean(4,14,24)
谢谢!