Message-ID: <CAAxdm-4kiTi-hrpELjBC-dAELEPPwfMiddfoogbmLzLTXy7Hgg@mail.gmail.com>
Date: 2012-09-10T19:07:11Z
From: jim holtman
Subject: Identifying duplicate rows?
In-Reply-To: <1347301422295-4642679.post@n4.nabble.com>
try this:
dfA$dups<-duplicated(dfA$Value) | duplicated(dfA$Value, fromLast = TRUE)
On Mon, Sep 10, 2012 at 2:23 PM, kborgmann <borgmann at email.arizona.edu> wrote:
> Hi,
> I am trying to identify duplicate values in a column in a date frame. The
> duplicated function identifies the duplicate rows in the data frame but it
> only does this for the second record, not both records. Is there a way to
> mark both rows in the data frame as TRUE?
> dfA$dups<-duplicated(dfA$Value)
> dfA
> Site State Value dups
> 929 VA 73 FALSE
> 929 VA 73 TRUE
> 930 VA 76 FALSE
> 930 VA 76 TRUE
> 931 VA 74 FALSE
> 932 VA 75 FALSE
>
> But I would like this
> Site State Value dups
> 929 VA 73 TRUE
> 929 VA 73 TRUE
> 930 VA 76 TRUE
> 930 VA 76 TRUE
> 931 VA 74 FALSE
> 932 VA 75 FALSE
>
> Thank you for your replies!
> Still on the learning curve,
> Kathi
>
>
>
> --
> View this message in context: http://r.789695.n4.nabble.com/Identifying-duplicate-rows-tp4642679.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.
--
Jim Holtman
Data Munger Guru
What is the problem that you are trying to solve?
Tell me what you want to do, not how you want to do it.