Hey Guys,

Thanks for the suggestions and instant reply.

merge(df1, df2, all=TRUE)

worked for my datasets.
And yes, I had rename the columns before doing that, as there were special
characters in the variables.

Thanks,
Shreyasee


On Wed, Aug 6, 2008 at 10:42 PM, John Kane <jrkrideau@yahoo.ca> wrote:

> You need to do the merge and then sum in a separate operation
>
> I think you may have to rename the columns. See ?names
>
>
> --- On Wed, 8/6/08, rkevinburton@charter.net <rkevinburton@charter.net>
> wrote:
>
> > From: rkevinburton@charter.net <rkevinburton@charter.net>
> > Subject: Re: [R] Merging two datasets
> > To: "Henrique Dallazuanna" <wwwhsd@gmail.com>, "Shreyasee Pradhan" <
> shreyasee.pradhan@gmail.com>
> > Cc: r-help@r-project.org
> > Received: Wednesday, August 6, 2008, 12:10 PM
> > I looked at 'merge'. What if df1 and df2 are
> > data.frames and I want to merge on on column and sum on
> > another? Say df1 and df2 are data.frames with columns
> > 'ID1', 'ID2', 'ID3', and
> > 'Qty'. I want to 'merge' the data frames
> > (and produce a new data.frame) if there is a matching
> > 'ID2' in each data.frame and if there is sum the
> > 'Qty' value from each data fame. First, I don't
> > see a function that can be applied during the merge. Maybe
> > that has to be done in a separate step. Next,
> > 'merge' seems to produce a data.frame with the
> > columns renamed. How can I preserve the column names?
> >
> > Thank you.
> >
> >
> > Kevin
> >
> > ---- Henrique Dallazuanna <wwwhsd@gmail.com> wrote:
> > > Try using:
> > >
> > > merge(df1, df2, all = TRUE)
> > >
> > > On Wed, Aug 6, 2008 at 11:15 AM, Shreyasee Pradhan
> > > <shreyasee.pradhan@gmail.com> wrote:
> > > > I am facing a problem in merging two datasets.
> > > > I have given codes to the names which are common
> > in both the datasets and
> > > > also to those which are uncommon.
> > > > When I gave gave the following command
> > > >
> > > > merge(df1,df2)
> > > >
> > > > only those rows and columns were merged which
> > were  having common codes.
> > > > When I viewed the results, only common codes are
> > seen and the remaining
> > > > entries are not seen.
> > > >
> > > > Can anyone guide me in this regards?
> > > > How should I merge these two datasets completely
> > without loss of any
> > > > information?
> > > >
> > > > Thanks,
> > > > Shreyasee
> > > >
> > > >        [[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.
> > > >
> > >
> > >
> > >
> > > --
> > > Henrique Dallazuanna
> > > Curitiba-Paraná-Brasil
> > > 25° 25' 40" S 49° 16' 22" O
> > >
> > > ______________________________________________
> > > 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.
> >
> > ______________________________________________
> > 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.
>
>
>       __________________________________________________________________
> Looking for the perfect gift? Give the gift of Flickr!
>
> http://www.flickr.com/gift/
>

	[[alternative HTML version deleted]]

