[R] basic array question

Uwe Ligges ligges at statistik.uni-dortmund.de
Fri Jun 2 10:26:44 CEST 2006


Tim Alcon wrote:
> I have a large array and would like to extract from it the row and 
> column indices just of values for which a particular boolean condition 

Do you mean a matrix, i.e. exactly 2 dimensions?

> is true.  I assume there's a simple way to do this, but I haven't 
> figured it out yet.  Any help would be appreciated.

Example:


  X <- matrix(1:9, 3)
  col(X)[X == 4]
  row(X)[X == 4]

Uwe Ligges

> Tim
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html



More information about the R-help mailing list