[R] a question on useage of "table"
David Scott
d.scott at auckland.ac.nz
Wed Jun 23 06:54:52 CEST 2004
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
More information about the R-help
mailing list