[R] different values of a vector

Andy Bunn abunn at whrc.org
Tue Mar 14 19:09:17 CET 2006


> -----Original Message-----
> From: r-help-bounces at stat.math.ethz.ch
> [mailto:r-help-bounces at stat.math.ethz.ch]On Behalf Of Arnau Mir
> Sent: Tuesday, March 14, 2006 12:45 PM
> To: r-help at stat.math.ethz.ch
> Subject: [R] different values of a vector
> 
> 
> Hello.
> 
> I have a vector of length 2771 but it has only 87 different values.
> How can I obtain them?

It depends on what obtain means. This should get you started.
foo <- sample(1:87,2771,T)
table(foo) #or...
levels(as.factor(foo))


> 
> Thanks,
> 
> Arnau.
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! 
> http://www.R-project.org/posting-guide.html
>




More information about the R-help mailing list