select rows with unidentical column values

Posted by Bazon on Stack Overflow See other posts from Stack Overflow or by Bazon
Published on 2010-05-20T01:08:00Z Indexed on 2010/05/20 1:10 UTC
Read the original article Hit count: 288

Filed under:
|

Hi Guys, I need to create a new data frame that excludes dams that appear in "dam1" and "dam2" columns on the same fosdate (fostering date). I tried df <- df[df$dam1!=dam2,] but did not work. Dam1 and dam2 are factors which are the ids's of mothers.

my df: fosdate dam1 dam2 8/09/2009 2Z523 2Z523 30/10/2009 1W509 5C080 30/10/2009 1W509 5C640 30/10/2009 1W509 1W509 1/10/2009 1W311 63927

The new data frame that I need to get is: dfnew: fosdate dam1 dam2 30/10/2009 1W509 5C080 30/10/2009 1W509 5C640 1/10/2009 1W311 63927

Would appreciate any help!

Bazon

© Stack Overflow or respective owner

Related posts about select

Related posts about rows