try the following "merge" command.

merge(A,B, by = intersect(names(A), names(B)), all.x=FALSE, all.y=FALSE)
or
merge(A,B, by = "ID", all.x=FALSE, all.y=FALSE)

Dannemora

On Wed, Aug 25, 2010 at 5:35 AM, Mangalani Peter Makananisa <
pmakananisa@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
>
>
>
> South Africa
>
> +27 12 422 7357
>
> +27 82 456 4669
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> Please Note: This email and its contents are subject to our email legal
> notice which can be viewed at http://www.sars.gov.za/Email_Disclaimer.pdf
>
>        [[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.
>

	[[alternative HTML version deleted]]

