Thanks to all for your insightful comments. I must admit I was unaware of the application to arrays.
Ben Prof Brian Ripley wrote: > Or that the vision of the original designer was not limited to > matrices. It just so happens that in this example the replacement is a > single dimension the same size as the single margin used. That's > atypical, and normally the result dimension has no connection to the > margin. The design is to put the result dimension first, and the > first item in the 'seealso' list is aperm(). > > To my mind the only general solutions are to put the result dimension > first or last. I would have used last, but using first is slightly > more efficient for the reason Pat gives. > > apply() is for arrays, operating over one or more margins with a > function returning a 'scalar', vector or array result. Perhaps any > 'lazy'-ness / limit of vision is not in handling array results as well > as might be possible. ______________________________________________ [email protected] 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.
