Re: [R] Help to select the raw in a data.frame with the max value

2009-04-26 Thread David Winsemius
On Apr 26, 2009, at 8:02 AM, Alessandro wrote: Dear User, thank for the attention. I have a data.frame with 5 columns (ex:ID, a1,a2,a3,a4) and 1000 rows. I wish to find the absolute max value for all data.frame and save a new data.frame with the row where is that value. Ex: ID: 1,2,3,4,5,

Re: [R] Help to select the raw in a data.frame with the max value

2009-04-26 Thread Jorge Ivan Velez
Dear Alessandro, Here is one way: DF <- data.frame(ID,a1,a2,a3,a4) Row <- which( DF == max(DF[,-1]), arr.ind = TRUE)[1] DF[Row,] # ID a1 a2 a3 a4 # 10 10 10 20 30 40 See ?which and ?max for more details. HTH, Jorge On Sun, Apr 26, 2009 at 8:02 AM, Alessandro wrote: > Dear User, > > > > t

[R] Help to select the raw in a data.frame with the max value

2009-04-26 Thread Alessandro
Dear User, thank for the attention. I have a data.frame with 5 columns (ex:ID, a1,a2,a3,a4) and 1000 rows. I wish to find the absolute max value for all data.frame and save a new data.frame with the row where is that value. Ex: ID: 1,2,3,4,5,6,7,8,9,10 a1:1,2,3,4,5,6,7,8,9,10 a2:11,12,13,