s-news
[Top] [All Lists]

Re: intersection of 2 dataframes

To: jdakin@OVERWEY.demon.co.uk
Subject: Re: intersection of 2 dataframes
From: "Ronald WH Verwer" <R.Verwer@nin.knaw.nl>
Date: Thu, 22 Jun 2006 08:56:10 +0200
Cc: s-news@lists.biostat.wustl.edu, paulmatthias.diderichsen@abbott.com
In-reply-to: <E1FsiF5-000IcH-4V@pr-webmail-2.demon.net>
Reply-to: r.verwer@nin.knaw.nl
Using Paul Diderichsen's example


> f<-data.frame(a=c(1,2,3),b=c(2,2,3))
> g<-data.frame(a=c(3,2,1),b=c(2,2,3))
> h<-rbind(f,g)

I guess you actually want

> x <- which(duplicated(h))- length(f$a)
> x
[1] 2
which indicates that the 2 row in both frames are identical


kind regards

Ronald


Ronald W.H. Verwer
Netherlands Institute for Neuroscience
Meibergdreef 33
1105 AZ Amsterdam
The Netherlands
tel: 020-5665518
fax: 020-6961006
email: r.verwer@nin.knaw.nl
web-site:www.nin.knaw.nl/~verwer
<Prev in Thread] Current Thread [Next in Thread>