Hi, all the question is as follows> v[1] 1 2 3 4 5 2 3 4 5 6> sv<-sort(table(v)) > svv 1 6 2 3 4 5 1 1 2 2 2 2 what is the easy and quick way to extract the numerical vector (1,6,2,3,4,5) from sv? thank you in advance for any suggestion. regards y.w
as.numeric(names(sv)) is one way.>>> Yong Wang <wang at galton.uchicago.edu> 06/23/04 02:14pm >>>Hi, all the question is as follows> v[1] 1 2 3 4 5 2 3 4 5 6> sv<-sort(table(v)) > svv 1 6 2 3 4 5 1 1 2 2 2 2 what is the easy and quick way to extract the numerical vector (1,6,2,3,4,5) from sv? thank you in advance for any suggestion. regards y.w ______________________________________________ R-help at stat.math.ethz.ch mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
On Tue, 22 Jun 2004, Yong Wang wrote:> Hi, all > the question is as follows > > v > [1] 1 2 3 4 5 2 3 4 5 6 > > sv<-sort(table(v)) > > sv > v > 1 6 2 3 4 5 > 1 1 2 2 2 2 > > > what is the easy and quick way to extract the numerical vector > (1,6,2,3,4,5) > from sv? >> as.numeric(names(sv))[1] 1 6 2 3 4 5 David Scott _________________________________________________________________ David Scott Department of Statistics, Tamaki Campus The University of Auckland, PB 92019 Auckland NEW ZEALAND Phone: +64 9 373 7599 ext 86830 Fax: +64 9 373 7000 Email: d.scott at auckland.ac.nz Graduate Officer, Department of Statistics