[R] Extracting non-matching elements of one vector from another

Duncan Murdoch murdoch.duncan at gmail.com
Sat Dec 31 19:50:01 CET 2016

On 31/12/2016 1:36 PM, Dan Abner wrote:
> Hi all,
> I have 2 vectors and need to extract only the elements from v2 that do not
> appear in v1. What is the most efficient way to do this?
> In the example below, I need to extract "var1".
> v1<-"b0"
> v2<-c("b0","var1")

setdiff(v2, v1)

Duncan Murdoch

More information about the R-help mailing list