[R] alternative to table

Jan Malte Wiener jan.wiener at tuebingen.mpg.de
Wed May 15 08:32:23 CEST 2002


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



More information about the R-help mailing list