[R] Merging two data set in R,

Sarah Goslee sarah.goslee at gmail.com
Wed Aug 25 13:51:50 CEST 2010


First you need to clarify what you'd like to happen when the ID in B
is not unique. What do you want the resulting dataframe to look
like?

Some possible answers involve using different options for merge() or
using unique() to remove duplicates from B before merging. But
at least to me, "merge or retrieve the common ones" isn't clear
enough to be able to say which.

Sarah

On Wed, Aug 25, 2010 at 5:35 AM, Mangalani Peter Makananisa
<pmakananisa at sars.gov.za> wrote:
> Dear R Gurus,
>
>
>
> I am currently working on the two dataset ( A and B), they both have the
> same fields:    ID , REGION, OFFICE, CSTART, CEND, NCYCLE, STATUS and
> CB.
>
> I want to merge the two data set by ID. The problem I have is that the
> in data A, the ID's are unique. However in the data set B, the ID's are
> not unique, thus some repeat themselves.
>
>
>
> How do I the merge or retrieve the common ones?
>
> Please advise.
>
>
>
> Kind Regards
>
>
>
> Peter
>

-- 
Sarah Goslee
http://www.functionaldiversity.org



More information about the R-help mailing list