hi, i have a matrix with repeated measures of subjects, e.g. (col 1 subject, col 2 = data) x1 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
?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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Use unique(x[,1]) Andrea 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 > _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._ >-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
On Wed, May 15, 2002 at 08:32:23AM +0200, 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)).unique(x[,1]) should work nicely. Cheers Jason -- Indigo Industrial Controls Ltd. 64-21-343-545 jasont at indigoindustrial.co.nz -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._