[R] How to combine two data frames by ID

jim holtman jholtman at gmail.com
Wed Jul 15 03:24:35 CEST 2009


?merge

On Tue, Jul 14, 2009 at 9:07 PM, Christopher
Desjardins<cddesjardins at gmail.com> wrote:
> Hi,
>
> I am trying to combine two data frames by ID. The first data frame is the
> whole data set and the second data frame is a subset of the first. What I
> would like to do is take the values from variable, p1, from the second data
> frame and merge them back into that variable in the first data frame. I have
> ID variables that match for both data frames and the data frames obviously
> have differing number of rows where the first data frame > second data
> frame. I want to keep the pre existing data for this variable that is
> present in the first data frame and only write over the data that I edited
> in the second.
>
> Thanks and please cc me as I am a digest subscriber,
> Chris
>
> ______________________________________________
> 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.
>



-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem that you are trying to solve?




More information about the R-help mailing list