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

David Winsemius dwinsemius at comcast.net
Thu Oct 13 18:48:29 CEST 2011


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 numbers are 1 and 0 I  
> want to
> remove the row with the 0.
>

?duplicated

> 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

But with no 1's associated with 'd' this does not make sense.

>
>
> Many thanks,
> Syrvn


David Winsemius, MD
West Hartford, CT



More information about the R-help mailing list