Re: [R] Remove specific rows in a matrix/data.frame

2011-10-13 Thread Eik Vettorazzi
Hi, just put it in the formula: aggregate(Number ~ Letter+Test,data=dtf,max) cheers Am 13.10.2011 19:30, schrieb syrvn: > Hello again, > > > dtf<-read.table(textConnection("Letter Test Number > a b 1 >

Re: [R] Remove specific rows in a matrix/data.frame

2011-10-13 Thread syrvn
Hello again, dtf<-read.table(textConnection("Letter Test Number a b 1 a b 1 b b 1

Re: [R] Remove specific rows in a matrix/data.frame

2011-10-13 Thread syrvn
Thanks for your answers! Will check them now :) Yes, sorry, I was wrong. Letter Number d 0 d 0 should be: Letter Number d 0 after applying the algorithm! -- View this message in context: http://r.789695.n4.nabble.com/Remove-specific-rows-in-a-matrix-data-frame-tp3902149p3902216.html Sent fro

Re: [R] Remove specific rows in a matrix/data.frame

2011-10-13 Thread Jean V Adams
syrvn wrote on 10/13/2011 11:42:44 AM: > > Hi, > > > imagine the following matrix/data.frame > > Letter Number > a 1 > a 1 > b 1 > b 0 > c 0 > c 1 > d 0 > d 0 > > If the numbers for two identical letters are also identical then I want to > remove either the first or the > second row of that

Re: [R] Remove specific rows in a matrix/data.frame

2011-10-13 Thread Vining, Kelly
...@r-project.org] On Behalf Of syrvn Sent: Thursday, October 13, 2011 9:43 AM To: r-help@r-project.org Subject: [R] Remove specific rows in a matrix/data.frame Hi, imagine the following matrix/data.frame Letter Number a 1 a 1 b 1 b 0 c 0 c 1 d 0 d 0 If the numbers for two identical letters are

Re: [R] Remove specific rows in a matrix/data.frame

2011-10-13 Thread jim holtman
try this: > x <- read.table(textConnection("Letter Number + a 1 + a 1 + b 1 + b 0 + c 0 + c 1 + d 0 + d 0"), as.is = TRUE, header = TRUE) > closeAllConnections() > # following assumes that there are pairs of numbers > result <- do.call(rbind, lapply(split(x, x$Letter), function(.pair){ + if (a

Re: [R] Remove specific rows in a matrix/data.frame

2011-10-13 Thread Eik Vettorazzi
Hi Syrvn, how about this dtf<-read.table(textConnection("Letter Number a 1 a 1 b 1 b 0 c 0 c 1 d 0 d 0"),header=T) aggregate(Number~Letter,data=dtf,max) cheers. Am 13.10.2011 18:42, schrieb syrvn: > Hi, > > > imagine the following matrix/data.frame > > Letter Number > a 1 > a 1 > b 1 > b 0 > c

Re: [R] Remove specific rows in a matrix/data.frame

2011-10-13 Thread David Winsemius
On Oct 13, 2011, at 12:42 PM, syrvn wrote: Hi, imagine the following matrix/data.frame Letter Number a 1 a 1 b 1 b 0 c 0 c 1 d 0 d 0 If the numbers for two identical letters are also identical then I want to remove either the first or the second row of that letter. If for a letter the nu

[R] Remove specific rows in a matrix/data.frame

2011-10-13 Thread syrvn
Hi, imagine the following matrix/data.frame Letter Number a 1 a 1 b 1 b 0 c 0 c 1 d 0 d 0 If the numbers for two identical letters are also identical then I want to remove either the first or the second row of that letter. If for a letter the numbers are 1 and 0 I want to remove the row with t