[R] alternative to table
ripley@stats.ox.ac.uk
ripley at stats.ox.ac.uk
Wed May 15 09:08:22 CEST 2002
?unique.
On Wed, 15 May 2002, Jan Malte Wiener wrote:
> hi,
> i have a matrix with repeated measures of subjects, e.g. (col 1 =
> subject, col 2 = data)
>
> x=
> 1 7
> 1 6
> 1 9
> 2 8
> 2 9
> 2 2
> 3 4
> 3 5
> 3 3
>
> i now would like to have a vector that only carries the different values
> of column 1 (only one entry per value -> (1,2,3)).
> right now i am doing this with:
>
> a<-table(x[,1])
> a<-names(a)
>
> that works rather fine, but "a" now carries characters not numbers.
> Since I want to use that vector to extract the data of individual
> subjects from "x", I either have to convert characters to numbers (not
> elegant) or find a different function that solves my problem.
> any ideas ?
>
> thanks,
> jan
> -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
> r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
> Send "info", "help", or "[un]subscribe"
> (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
> _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
>
--
Brian D. Ripley, ripley at stats.ox.ac.uk
Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel: +44 1865 272861 (self)
1 South Parks Road, +44 1865 272860 (secr)
Oxford OX1 3TG, UK Fax: +44 1865 272595
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
More information about the R-help
mailing list