On Fri, Apr 5, 2013 at 2:08 PM, Keith S Weintraub <kw1...@gmail.com> wrote:
> And to the rest of you good R folks I would still be interested to see a 
> working example of arrayInd, what it's supposed to do and what it's used for.

A little utility function for dealing with the
matrix-is-really-a-vector indexing duality. (Elemental (1,3) vs linear
#4 indexing)

E.g.,

x <- matrix(rnorm(9), 3, 3)

which.min(x) # Not super helpful

where.min <- function(x) arrayInd(which.min(x), dim(x), dimnames(x), T)

where.min(x) # Perhaps better

Cheers,
Michael

______________________________________________
R-help@r-project.org 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.

Reply via email to