[R] alternative to table

Joerg Maeder maeder at atmos.umnw.ethz.ch
Wed May 15 10:08:33 CEST 2002


Hallo Jan

what about unique(x[,1])

gruess

joerg

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
> _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._

-- 
Joerg Maeder    .:|:||:..:.||.::   maeder at atmos.umnw.ethz.ch
Tel: +41 1 633 36 25   .:|:||:..:.||.::   
http://www.iac.ethz.ch/staff/maeder
PhD student at INSTITUTE FOR ATMOSPHERIC AND CLIMATE SCIENCE (IACETH)
ETH ZÜRICH Switzerland
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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