I have an 3D array - arr
dim(arr)
[1] 2000 22 3
Let's call 2000 dim1
, 22 dim2
, and 3 dim3
.
I would like to do something like this:
for(d1 in 1:dim1){
for(d2 in 1:dim2){
#compute the mean across the 2000 values of arr[d1,d2]
m<-mean(arr[d1,d2])
}
}
Any idea?