[R] Remove vector elements from another vector

Dimitris Rizopoulos dimitris.rizopoulos at med.kuleuven.be
Thu Sep 15 16:32:31 CEST 2005


look at function ?setdiff(), e.g.,

setdiff(a, b)


I hope it helps.

Best,
Dimitris

----
Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
School of Public Health
Catholic University of Leuven

Address: Kapucijnenvoer 35, Leuven, Belgium
Tel: +32/16/336899
Fax: +32/16/337015
Web: http://www.med.kuleuven.be/biostat/
     http://www.student.kuleuven.be/~m0390867/dimitris.htm


----- Original Message ----- 
From: "Karsten Luder" <kalleswedens at hotmail.com>
To: <r-help at stat.math.ethz.ch>
Sent: Tuesday, September 13, 2005 2:35 PM
Subject: [SPAM?] [R] Remove vector elements from another vector


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)?

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


Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm




More information about the R-help mailing list