Will something like this work for you:

> x <- cbind(runif(10), runif(10))
> x
            [,1]      [,2]
 [1,] 0.26550866 0.2059746
 [2,] 0.37212390 0.1765568
 [3,] 0.57285336 0.6870228
 [4,] 0.90820779 0.3841037
 [5,] 0.20168193 0.7698414
 [6,] 0.89838968 0.4976992
 [7,] 0.94467527 0.7176185
 [8,] 0.66079779 0.9919061
 [9,] 0.62911404 0.3800352
[10,] 0.06178627 0.7774452
> x[which.max(x[,2]),1]
[1] 0.6607978
>


On Tue, Dec 29, 2009 at 1:48 PM, Wade Wall <wade.w...@gmail.com> wrote:

> Hi all,
>
> I have two columns of data, the first consists of parameter estimates and
> the second probability estimates.  I would like to extract the value from
> the first column based on the max value of column two, but not sure how to
> do this other than by extracting the value and then manually finding the
> value in the first column.  Anyone know how to do this?  Basically, I need
> to find the row number for the maximum in column two and use that value to
> extract the value at the same row number in column one.
>
> Thanks for any help,
>
> Wade
>
>        [[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<http://www.r-project.org/posting-guide.html>
> and provide commented, minimal, self-contained, reproducible code.
>



-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem that you are trying to solve?

        [[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