[R] Remove several numbers from a sequence

Berend Hasselman bhh at xs4all.nl
Fri Aug 17 18:51:38 CEST 2012


On 17-08-2012, at 18:18, penguins wrote:

> Can anyone tell me how to remove several numbers for a sequence. For example:
> 
> xx<- c(1,5,7,10)
> yy<-seq(1,10,1)
> 
> how do I get take xx away from yy to get the new sequence 
> 
> 2,3,4,6,8,9
> 
You can also do this

yy[!(yy %in% xx)]

Berend




More information about the R-help mailing list