Dear Lister,
I understand merge() can be used to join 2 data frames based on 1 variable.
But how about merge based on more than 2 variables?
Thank you so much!
--
WenSui Liu
(http://spaces.msn.com/statcompute/blog)
Senior Decision Support Analyst
Health Policy and Clinical Effectiveness
Wensui Liu wrote:
Dear Lister,
I understand merge() can be used to join 2 data frames based on 1 variable.
But how about merge based on more than 2 variables?
Thank you so much!
Just specify the 2 (or more) variable names in a column vector for by)
merge(dat1, dat2, by= c(VarA, VarB))
what if the names are different in 2 data frames?
On 8/14/06, Simon Blomberg [EMAIL PROTECTED] wrote:
Wensui Liu wrote:
Dear Lister,
I understand merge() can be used to join 2 data frames based on 1 variable.
But how about merge based on more than 2 variables?
Thank you so much!
Then instead of by, use by.x and by.y to specifiy the variable names
separately for both data frames. See ?merge, especially the examples.
Wensui Liu wrote:
what if the names are different in 2 data frames?
On 8/14/06, Simon Blomberg [EMAIL PROTECTED] wrote:
Wensui Liu wrote: