[R] how to merge 2 data frame if you want to exclude mutual obs

ramoss ramine.mossadegh at finra.org
Mon May 13 21:22:27 CEST 2013


In the example below, I am merging 2 data frames & I want everything in the
first one(all)
all2 <- merge(all,spets, by.x=c("tdate","symbol"),
by.y=c("tdate","symbol"),all.x=TRUE)

What if I want to exclude everything in y? I tried below but doesn't seem to
work.
all2 <- merge(all,spets, by.x=c("tdate","symbol"),
by.y=c("tdate","symbol"),all.y=FALSE)

In SAS I  would do:

All2;
  merge all(in=a)
             spetz(in=b)
            ;
 by tdate symbol;
 if a and not b;
run;

How can I do this in R?
Thanks ahead for your help.



--
View this message in context: http://r.789695.n4.nabble.com/how-to-merge-2-data-frame-if-you-want-to-exclude-mutual-obs-tp4666975.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list