[R] help with repeated values

Carlos J. Gil Bellosta cgb at datanalytics.com
Mon Dec 7 03:06:55 CET 2009


Here you have an example:

 > colleges <- factor( c("a", "a", "b", "c", "c" ))
 > colleges
[1] a a b c c
Levels: a b c
 > table( colleges )
colleges
a b c
2 1 2
 > colleges.count <- table( colleges )[colleges]
 > colleges.count
colleges
a a b c c
2 2 1 2 2
 > which( colleges.count > 1 )
a a c c
1 2 4 5


Kristen Mark wrote:
> I have a huge college dataset and I want to be able to find which colleges appear more than once in the dataset. How would I go about doing this? The variable college is a factor. If I just do table(college) it is impossible to find where there are repetitions. Any help would be greatly appreciated!
> 
> Lynna 
> 
> 
>       
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> 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.
>




More information about the R-help mailing list