i have two data frames. One data frame contains one column with the identificication number of a geographic place. The other columns are just some data about the corresponding geographic place. The other data frame also contains one column with the id number of a geographic place. the other columns of the second data frame is other data about the corresponding geographic place. I want to make one data frame which has the id numbers and the corresponding data from both the first and second data frames. how do you do this? -- View this message in context: http://www.nabble.com/combining-two-data-frames-%28different-question%29-tp17956259p17956259.html Sent from the R help mailing list archive at Nabble.com.
cmr.Pent at gmail.com
2008-Jun-18 08:39 UTC
[R] combining two data frames (different question)
Try> ?mergeAndrey
?merge On Tue, Jun 17, 2008 at 6:40 PM, calundergrad <haibinglin at berkeley.edu> wrote:> > i have two data frames. One data frame contains one column with the > identificication number of a geographic place. The other columns are just > some data about the corresponding geographic place. The other data frame > also contains one column with the id number of a geographic place. the > other columns of the second data frame is other data about the corresponding > geographic place. > > I want to make one data frame which has the id numbers and the corresponding > data from both the first and second data frames. > > how do you do this? > -- > View this message in context: http://www.nabble.com/combining-two-data-frames-%28different-question%29-tp17956259p17956259.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > 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 you are trying to solve?
This depends on the id column. If all the id's are the same and in the exact same order then look at ?cbind. If you have different numbers or different ids in the two id columns see ?merge --- On Tue, 6/17/08, calundergrad <haibinglin at berkeley.edu> wrote:> From: calundergrad <haibinglin at berkeley.edu> > Subject: [R] combining two data frames (different question) > To: r-help at r-project.org > Received: Tuesday, June 17, 2008, 6:40 PM > i have two data frames. One data frame contains one column > with the > identificication number of a geographic place. The other > columns are just > some data about the corresponding geographic place. The > other data frame > also contains one column with the id number of a geographic > place. the > other columns of the second data frame is other data about > the corresponding > geographic place. > > I want to make one data frame which has the id numbers and > the corresponding > data from both the first and second data frames. > > how do you do this? > -- > View this message in context: > http://www.nabble.com/combining-two-data-frames-%28different-question%29-tp17956259p17956259.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > 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.__________________________________________________________________ [[elided Yahoo spam]]