[R] indexing a vector
jdm at xnet.com
Tue May 8 01:55:29 CEST 2001
----- Original Message -----
From: Thomas Lumley <tlumley at u.washington.edu>
Sent: Monday, May 07, 2001 1:38 PM
> On Mon, 7 May 2001, David White wrote:
> > Dear R-List,
> > How can one look up the row/column number for a given value in a matrix
> > data.frame? For example in a matrix that contains only unique values
> > in [,1] how can I find value x in [,1] and report its row number?
As a follow up to this question, what's the easiest way to
find the column and row indicies for a specified value in a matrix,
when you don't know which column it's in (as assumed above)?
So if mymatrix <- matrix(c(3, 2, 4, 1), nrow = 2), what's the easiet
to see that the value 4 is in position (1, 2) ?
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
More information about the R-help