As Jim suggested, the duplicated() function should help.

If I understand what you're after, you could try something like this.  I 
assumed that the name of your data frame was "df".

selrows <- df$WorkerID %in% df$WorkerID[duplicated(df$WorkerID)]

# SubjectNumbers with duplicate WorkerIDs
df$SubjectNumber[selrows]

# Full records with duplicate WorkerIDs
df[selrows, ]

Jean


jim holtman wrote on 09/21/2011 10:13:49 PM:
> 
> ?duplicated
> 
> Hard to give a specific solution unless you follow the posting guide
> and provide a subset of the data to test on.
> 
> On Wed, Sep 21, 2011 at 7:31 PM, stevesp101 <sanpietro.st...@gmail.com> 
wrote:
> > Hi,
> >
> > I'm trying to find out if there is a command that tells me which cells 
in my
> > data frame have the same value.  I am looking at the results from an 
online
> > survey, organized into a data frame with the following columns:
> > SubjectNumber, WorkerID, Age.  I know the one person must have taken 
the
> > survey more than once, because there is one less level in the WorkerID
> > column than there are rows in the data frame.  Is there something that 
will
> > tell me which SubjectNumber cells correspond to more than one WorkerID 
cell?
> > Thanks,
> >
> > Stevesp
> >
> 
> -- 
> Jim Holtman
> Data Munger Guru
> 
> What is the problem that you are trying to solve?

        [[alternative HTML version deleted]]

______________________________________________
R-help@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.

Reply via email to