Re: [R] Finding row in matrix with minimum column

From: Jorge Ivan Velez <jorgeivanvelez_at_gmail.com>
Date: Wed, 18 May 2011 22:51:31 -0400

Hi Worik,

See ?which.min

x <- matrix(c(7, 7, 9, 7, 7, 9, 2, 9), ncol = 2, byrow = FALSE) which.min(x[,2])
x[which.min(x[,2]), ]

HTH,
Jorge

On Wed, May 18, 2011 at 10:38 PM, Worik R <> wrote:

> Friends
>
> If I have a matrix such as...
>
> [,1] [,2]
> [1,] 7 7
> [2,] 7 9
> [3,] 9 2
> [4,] 7 9
>
> And I want to find the row number that has the minimum value of column 2
> (row 3 in this case) how can I do it? Is there a simple way?
>
> cheers
> Worik
>
> [[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.
>

        [[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. Received on Thu 19 May 2011 - 02:54:51 GMT

This quarter's messages: by month, or sorted: [ by date ] [ by thread ] [ by subject ] [ by author ]

All messages

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 19 May 2011 - 04:30:07 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive