As Burt says it is not exactly clear what you want but is something like this 
what you are looking for?

dat1  <-  data.frame(aa = c("a", "b", "c"), bb = 1:3)
dat2  <-  data.frame(xx = c("b", "c", "d"), yy = 3:1)
merge(dat1, dat2, by.x = "aa", by.y = "xx")

For further reference here are some suggestions about asking questions on the 
R-help list.  In particular it is very helpful if data is supplied in dput() 
form (See ?dput for details)

John Kane
Kingston ON Canada


> -----Original Message-----
> From: r-help@r-project.org
> Sent: Mon, 1 Jun 2015 13:46:15 +0000 (UTC)
> To: r-help@r-project.org
> Subject: [R] merge function
> 
> Hi,By default the merge function should take the intersection of column
> names (if this is understood from by = intersect(names(x), names(y)), but
> it takes all columns. How to specify the intersection of column names?
>  Thanks
> Carol
> 
>       [[alternative HTML version deleted]]
> 
> ______________________________________________
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

____________________________________________________________
Can't remember your password? Do you need a strong and secure password?
Use Password manager! It stores your passwords & protects your account.

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to