Hello, Is there an easy way (other than the obvious for loop?) to select distinct values from a column vector? Many thanks Ann
On Fri, 2004-11-19 at 19:01 +0000, Ann Huxtable wrote:> Hello, > > Is there an easy way (other than the obvious for loop?) to select distinct > values from a column vector? > > Many thanks > > AnnPresuming that by 'distinct' you mean 'unique', see ?unique> MyVec <- rep(1:5, times = c(1:5))> MyVec[1] 1 2 2 3 3 3 4 4 4 4 5 5 5 5 5> unique(MyVec)[1] 1 2 3 4 5 HTH, Marc Schwartz