Re: [R] identifying cells in data frames with the same value

2011-09-23 Thread stevesp101
Thanks very much to both of you.  Duplicated does exactly what I'm looking
for.

Sorry -- I didn't realize that I was supposed to provide a subset of my data
frame.  A little late now, but here it is -- the data frame is called
SubInfo, and it gives background informations on subjects from a survey:

> dput(SubInfo)
structure(list(Subject = 1:48, Workerid = structure(c(33L, 23L, 
16L, 21L, 11L, 44L, 47L, 7L, 39L, 36L, 38L, 15L, 2L, 45L, 22L, 
14L, 19L, 37L, 5L, 17L, 20L, 29L, 13L, 43L, 42L, 8L, 3L, 1L, 
24L, 35L, 6L, 9L, 28L, 4L, 41L, 34L, 10L, 25L, 18L, 9L, 27L, 
12L, 46L, 30L, 31L, 26L, 40L, 32L), .Label = c("A16BIY1187GJ8I", 
"A175PJR0W3LO8i", "A17AT6S84ZFYWG", "A18QT7CR516RCY", "A198LBD7JZ4MRN", 
"A1BRP5AG7W8ZHS", "A1E0EK09CA5OiO", "A1E3iEF9JNJi53", "A1E3IEF9JNJI53", 
"A1FKOJKKBNQWM0", "A1JQS9AN8LEAKZ", "A1LBK6WW8KWZ33", "A1N914XTP4CJ7X", 
"A1P5PJZSYJVDHW", "A1RG33R69110SS", "A1RWNYJA5X25YH", "A1S70ZQ1ZWQ9DL", 
"A1V7V575QQGVDR", "A1WGSW0SLN4Y91", "A1Y0KX38WMS7VE", "A1Y25W1Y7KDE5", 
"A1Z6YiiHH2BARZ", "A23GOiRMXZ2TWi", "A2BNOEYZ3VRW2R", "A2J734LHPHBFKL", 
"A2MGH3MBXMKD96", "A2V3P1XE33NYC3", "A39RBYX03I6A51", "A3F3K6UZXFECJ1", 
"A3ICTZEPK4YUG", "A3IRZNKWK21P7G", "A3KO392GXBRUNW", "A3OLBiOP3Q6ZTX", 
"A3OZ8KF0HWSVWK", "A3PXV3J5IEUTA9", "A3S5L3i8O3Q2G", "A3TYWTLNiKKD29", 
"A3UZTA5Z0i666X", "A5HNNY0JAiAEL", "A91OXJPTS9K30", "AAIVI6RFHIISN", 
"ADKVWT5G226AW", "AM43UEVBOUDTY", "AOMQPLPiBDFJ5", "AQTNAR72ARCAM", 
"ARB4PAABFRZA4", "AYJF016iTKKW9"), class = "factor"), Age = structure(c(17L, 
25L, 30L, 23L, 16L, 14L, 11L, 24L, 11L, 9L, 12L, 10L, 11L, 4L, 
9L, 31L, 20L, 3L, 9L, 27L, 24L, 28L, 19L, 22L, 15L, 6L, 8L, 1L, 
29L, 5L, 8L, 5L, 7L, 26L, 7L, 21L, 13L, 13L, 17L, 7L, 18L, 6L, 
9L, 26L, 2L, 19L, 12L, 15L), .Label = c("18", "19", "20", "21", 
"22", "23", "24", "25", "26", "27", "28", "29", "30", "34", "36", 
"37", "38", "40", "41", "44", "45", "47", "50", "53", "54", "55", 
"57", "58", "60", "61", "N/A"), class = "factor")), .Names = c("Subject", 
"Workerid", "Age"), class = "data.frame", row.names = c(NA, -48L
))

The code that Jean suggested works perfectly:

selrows <- SubInfo$Workerid %in%
SubInfo$Workerid[duplicated(SubInfo$Workerid)]

Thanks!
Stevesp101

--
View this message in context: 
http://r.789695.n4.nabble.com/identifying-cells-in-data-frames-with-the-same-value-tp3831881p3837191.html
Sent from the R help mailing list archive at Nabble.com.

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


[R] identifying cells in data frames with the same value

2011-09-21 Thread stevesp101
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

--
View this message in context: 
http://r.789695.n4.nabble.com/identifying-cells-in-data-frames-with-the-same-value-tp3831881p3831881.html
Sent from the R help mailing list archive at Nabble.com.

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