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

Vining, Kelly Kelly.Vining at oregonstate.edu
Thu Oct 13 18:51:56 CEST 2011


Why would you end up with d1 in your output if you don't have a d1 in your original data frame? Are you saying that, when both letters have a zero after them, you want to replace one of them with a 1?



-----Original Message-----
From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On Behalf Of syrvn
Sent: Thursday, October 13, 2011 9:43 AM
To: r-help at 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 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 the 0.

That means if the code works I would and up with the following matrix/data.frame

Letter Number
a 1
b 1
c 1
d 1


Many thanks,
Syrvn


--
View this message in context: http://r.789695.n4.nabble.com/Remove-specific-rows-in-a-matrix-data-frame-tp3902149p3902149.html
Sent from the R help mailing list archive at Nabble.com.

______________________________________________
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.



More information about the R-help mailing list