Re: [R] select duplicate identifier with higher mean across sample columns

2012-11-05 Thread Adrian Johnson
Thanks a lot for the help. -Adrian On Sun, Nov 4, 2012 at 2:39 PM, jim holtman wrote: > Is this what you want: > >> mdf <- read.table(text = " id samp1 samp2 samp2a > + 1 A 100 110110 > + 2 A 120 130150 > + 3 C 101 131151 > + 4 D 110 150130 > + 5 E 132 12

Re: [R] select duplicate identifier with higher mean across sample columns

2012-11-04 Thread arun
To: r-help Cc: Sent: Sunday, November 4, 2012 2:25 PM Subject: [R] select duplicate identifier with higher mean across sample columns Hi Group: I searched R groups before posting this question. I could not find the appropriate answer and I do not have clear understanding how to do this in R. I

Re: [R] select duplicate identifier with higher mean across sample columns

2012-11-04 Thread Rui Barradas
Hello, Thanks for the data example. (You forgot samp2a). Try the following. mdf <- read.table(text=" id samp1 samp2 samp2a 1 A 100 110110 2 A 120 130150 3 C 101 131151 4 D 110 150130 5 E 132 122122 6 F 123 143143 ", header=TRUE) idx <- ave(

Re: [R] select duplicate identifier with higher mean across sample columns

2012-11-04 Thread jim holtman
Is this what you want: > mdf <- read.table(text = " id samp1 samp2 samp2a + 1 A 100 110110 + 2 A 120 130150 + 3 C 101 131151 + 4 D 110 150130 + 5 E 132 122122 + 6 F 123 143143", header = TRUE) > result <- do.call(rbind, lapply(split(mdf, mdf$i

[R] select duplicate identifier with higher mean across sample columns

2012-11-04 Thread Adrian Johnson
Hi Group: I searched R groups before posting this question. I could not find the appropriate answer and I do not have clear understanding how to do this in R. I have a data frame with duplicated row identifiers but with different values across columns. I want to select the identifier with higher i