[R] Merge dataframes with no shared rows, some shared and some unshared columns

From: <mtb954_at_gmail.com>
Date: Thu 23 Feb 2006 - 05:05:37 EST


Dear R-users,

I have two dataframes FIRST and SECOND that do not share any rows (i.e., there is no unique identifier linking the rows in the two dataframes, the rows are independent).

The dataframes have three variables (in columns) in common, but each dataframe also has some variables not shared by the other.

I wish to merge FIRST and SECOND into a THIRD dataframe, stacking the shared columns and including the unshared columns from FIRST and SECOND as columns in THIRD. Also, I wish rows in THIRD that do not have a value in a particular column (because they came from a dataframe without that column) to acquire the value "0" (zero).

Finally, it it possible to merge >2 dataframes using the merge function?

Any ideas? Thanks, Mark



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Thu Feb 23 05:18:14 2006

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:42:39 EST