[R] union of two data frames

Erik Iverson iverson at biostat.wisc.edu
Mon Feb 25 23:13:08 CET 2008


Perhaps this example might help you?


I create 2 sample data.frames, take a look at what they contain and then 
what the merge function gives.  Compare with all = FALSE.

df1 <- data.frame(a = 1:10, b = 11:20)
df2 <- data.frame(a = c(1:2,98),  b = c(11:12, 99))

merge(df1, df2, all = TRUE)

Erik Iverson wrote:
> You probably need to provide an example here, show us your data.frame 
> column names, and what you mean by 'common subset of the same data' at 
> least.  What did you try and what did it do that you didn't expect?
> 
> stephen sefick wrote:
>> I have a thirty thousand row data frame imported from excel and a
>> 60,000 row data frame imported from excel.  they share a common subset
>> of the same data and I would like to combine the two into one data
>> frame merged together on the data in common.  I have looked at the
>> help file for merge and intersect and cbind and rbind etc... And I
>> can't figure it out.  Thanks in advance
>>
>> Stephen
>>
> 
> ______________________________________________
> R-help at r-project.org mailing list
> 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.



More information about the R-help mailing list