Re: [R] remove multiple elements from vector

2008-09-28 Thread Marianne Promberger
On Saturday, 27 September 2008, 15:30 (UTC+0200), Bastian Offermann wrote: > Hello all, > > one brief question > > I would like to remove double/triple elements from a vector, e.g. > > 0 1 1 1 1 2 2 2 4 5 6 6 > > but keep one of these multiple ones. Should look like this finally: > > 0 1 2 4 5 6

Re: [R] remove multiple elements from vector

2008-09-27 Thread baptiste auguie
Hi, ?unique should work fine for this. I think the problem in your implementation is that you modify x in the loop, in particular its length may become shorter than the stopping condition. HTH, baptiste On 27 Sep 2008, at 14:30, Bastian Offermann wrote: Hello all, one brief question

[R] remove multiple elements from vector

2008-09-27 Thread Bastian Offermann
Hello all, one brief question I would like to remove double/triple elements from a vector, e.g. 0 1 1 1 1 2 2 2 4 5 6 6 but keep one of these multiple ones. Should look like this finally: 0 1 2 4 5 6 My function does not work somehow for(i in 2 : length(x)) {