[R] Eaxct position of specific elements in array

Gabor Grothendieck ggrothendieck at gmail.com
Sat Aug 2 07:00:05 CEST 2008


See ?row ?col

On Fri, Aug 1, 2008 at 1:42 PM, Ralph S. <ruffel1 at hotmail.com> wrote:
>
> Hi,
>
> I am trying to get the positions in array coordinates (needed later) of certain elements in an array but I am not sure how to get them.
>
> My array is Q and the condition is dt>dV, where dt and dV are arrays of exactly the same dimensions as Q.
>
> I know that I can extract the elements of Q by using Q[dt>dV] but I need the array position of where this happens.
>
> I don't see how to use the which() command since some elements given by that the condition are not unique
> ( I tried which(Q==Q[dt>dV] ,arr.ind=TRUE) but that gives me too many positions plus
> Warning message:
> In Q == Q[dt > dV] :
>  longer object length is not a multiple of shorter object length)
>
> Any help would be really appreciated!
>
> -Ralph
>
>
> _________________________________________________________________
>
>
>
>        [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at 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.
>



More information about the R-help mailing list