[R] How to combine two data frames by ID

Christopher Desjardins cddesjardins at gmail.com
Wed Jul 15 03:07:38 CEST 2009


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




More information about the R-help mailing list