Hello there

I wish to get the "coordinates" of the minimum element of an array.

For example, if the array were

> H = array(c(8:5,1:4),dim=c(2,2,2))
> H
, , 1

     [,1] [,2]
[1,]    8    6
[2,]    7    5

, , 2

     [,1] [,2]
[1,]    1    3
[2,]    2    4

then
> min(H)
[1] 1

and
> max(H)
[1] 8

Say "idx" were the function I'm looking for. Then, what I'm expecting is

> idx(min(H))
[1] 1 1 2
> idx(max(H))
[1] 1 1 1

Thanks in advance,

Eduardo de Oliveira Horta

        [[alternative HTML version deleted]]

______________________________________________
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