Dear R-users, I would like to apply a function (more precisely sd()) over the third dimension of a three-dimension array. The function apply would be interesting but the chosen function can only be applied on the rows and columns of the array according to the help file. I can use a loop to cut the array in matrices and then use apply for each replication, but it's not very nice. A small example:
a <- array(runif(1200),c(3,4,100)) b <- matrix(NA,3,4) for(j in 1:3){ b[j,] <- apply(a[j,,],1,sd) } Is there someting better than the use of a loop ? Thanks ______________________________________________ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.