[R] Remove vector elements from another vector

Uwe Ligges ligges at statistik.uni-dortmund.de
Thu Sep 15 16:26:12 CEST 2005


Karsten Luder wrote:

> Hello,
> 
> I have two vectors of different lengths. Fx a <- 1:9; b <- c(4, 5).
> What is the best way to remove the elements in vector b from vector a so 
> that the result would be a vector with elements c(1,2,3,6,7,8,9)?


setdiff(a, b)

Uwe Ligges


> Best regards,
> Kalle
> 
> _________________________________________________________________
> Find masser af gode tilbud på MSN Shopping http://shopping.msn.dk/
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html




More information about the R-help mailing list