s-news
[Top] [All Lists]

Re: extract row name of matrix

To: s-news@lists.biostat.wustl.edu
Subject: Re: extract row name of matrix
From: Sarah Henderson <sarah.henderson@ubc.ca>
Date: Wed, 05 Oct 2005 14:04:11 -0500

Thanks to Sundar Dorai-Raj and Eric Zivot for suggesting the use of which(), with which I have no previous experience. A good thing to know!

Thanks again,

Sarah


You want something that returns the index of the maximum.

which.max <- function(x) which(x == max(x))
dimnames(m)[[1]][which.max(m[, 3])]

HTH,

--sundar
--------------------------------------------------------------------
This message was distributed by s-news@lists.biostat.wustl.edu.  To
unsubscribe send e-mail to s-news-request@lists.biostat.wustl.edu with
the BODY of the message:  unsubscribe s-news


<Prev in Thread] Current Thread [Next in Thread>