[R] merging data frames
Jim Holtman
jholtman at gmail.com
Fri Jun 14 08:26:55 CEST 2013
?merge
Sent from my iPad
On Jun 14, 2013, at 0:51, Yasin Gocgun <entropy053 at gmail.com> wrote:
> Hi,
>
> I have been struggling with the issue of merging data frames that have
> common columns and have different dimensions. Although I made alot of
> search about it on internet, I could not find any function that would
> efficiently perform the required operation. So I would appreciate if anyone
> knowing how to resolve the problem would explain me the solution.
>
> As you will see, the below data frames have one common column (they would
> have multiple common columns in general), and I simply want to create a
> table that is the union of A and B, say table C. So the first row of C must
> include all the necessary info about the person with the respective COMPID,
> which is provided in A and B.
>
> A:
> COMPID CLR_DOT CA_TYPE CA_YEAR DT_FNDNG DT_BIOP NORMAL 1030956 XXGRX P 10
> 19890919 19890919 0 2511425 XXXRX T 6 19891005 19891030 0 3205129 XXGRX T
> 8 19900227 19900227 0 ...
>
> B:
> COMPID CNTR_ALL ALLOC AG_GRCAL ENRL_DT EXP_SCR 1000012 0 NO 1 19800122 5
> 1000021 0 NO 2 19800121 5 1000030 0 NO 3 19800121 5 1000049 0 NO 4
> 19800121 5 ...
>
> I tried rbind.fill but it did not work. I am aware that such operations can
> be done in SAS in a minute, so I thought R should be as efficient as SAS in
> performing such operations...
>
> Thank you in advance,
>
> Yasin
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> 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