Hi Hadley, Rteam,
I encountered similar issues trying to reproduce Matlab's "sort"
functionality.
[here "a" is array(1:27, c(2,3,4))]
In matlab, one can type sort(a,i) to sort along dimension i.
One can reproduce this functionality thus:
asort <- function(a,i,FUN="sort"){
j <- 1:length(dim
Dear all,
I have been working on an idempotent version of apply, such that
applying a function f(x) = x (ie. force) returns the same array (or a
permutation of it depending on the order of the margins):
a <- array(1:27, c(2,3,4))
all.equal(a, iapply(a, 1, force))
all.equal(a, iapply(a, 1:2, forc