tom soyer wrote: > Hi, > > I have two sets of data that I would like to put into a data frame. But > since they have different length, I am not sure how to do this. Here is an > example of my data: > > data set one: > date growth > 1/1/2007 10 > 1/2/2007 10.2 > 1/3/2007 10.4 > 1/4/2007 10.6 > > data set two: > date growth > 1/1/2007 22 > 1/2/2007 22.5 > 1/4/2007 22.4 > > I would like to combine the two data sets and create a data frame like this: > date growthA growthB > 1/1/2007 10 22 > 1/2/2007 10.2 22.5 > 1/3/2007 10.4 NA > 1/4/2007 10.6 22.4 > > Or skipping the missing data point all together, like this: > date growthA growthB > 1/1/2007 10 22 > 1/2/2007 10.2 22.5 > 1/4/2007 10.6 22.4 > > Right now I am doing this by hand, and it is really time consuming. I am > wondering if there is an easier way of creating data frames from unequal > length data using existing R functions. Is there a way to create data > with equal length based on the date column? I would appreciate any help from > the group. > > Thanks, > > I'd have a look at merge() if I were you.
-- O__ ---- Peter Dalgaard Ă˜ster Farimagsgade 5, Entr.B c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~~~~~~~~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907 ______________________________________________ R-help@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.