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

stevesp101 sanpietro.steve at gmail.com
Fri Sep 23 17:33:24 CEST 2011

Thanks very much to both of you.  Duplicated does exactly what I'm looking

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", 
"A1V7V575QQGVDR", "A1WGSW0SLN4Y91", "A1Y0KX38WMS7VE", "A1Y25W1Y7KDE5", 
"A2MGH3MBXMKD96", "A2V3P1XE33NYC3", "A39RBYX03I6A51", "A3F3K6UZXFECJ1", 
"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%


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.

More information about the R-help mailing list