Merge worked! Thanks!!!

On 11/28/07, Matthew Keller <[EMAIL PROTECTED]> wrote:
>
> Tom,
>
> Check out ?merge. Does exactly what you need
>
> Matt
>
> On Nov 28, 2007 11:27 AM, tom soyer <[EMAIL PROTECTED]> 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,
> >
> > --
> > Tom
> >
> >         [[alternative HTML version deleted]]
> >
> > ______________________________________________
> > 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.
> >
>
>
>
> --
> Matthew C Keller
> Asst. Professor of Psychology
> University of Colorado at Boulder
> www.matthewckeller.com
>



-- 
Tom

        [[alternative HTML version deleted]]

______________________________________________
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.

Reply via email to