Skip to content
Prev 199005 / 398506 Next

Issue with %in% - not matching identical rows in data frames

Kaushik,

The documentation doesn't quite tell (me, anyway) how the function behaves 
when 'target' is a list (or data.frame). You'll need to dig into match.c 
or experiment with match() or %in% to see what it is actually doing.

But it looks like it is matching whole columns of the data.frame rather 
than elements within each column :
[1] TRUE TRUE TRUE TRUE TRUE TRUE
[1] TRUE TRUE TRUE TRUE TRUE TRUE
[1] FALSE FALSE FALSE FALSE FALSE FALSE
[1] TRUE TRUE TRUE TRUE TRUE TRUE
Maybe you wanted something like

 	mapply( function(x,y) x%in%y , sequence[7, ], today.sequence )

??

HTH,

Chuck
On Tue, 3 Nov 2009, Kaushik Krishnan wrote:

            
Charles C. Berry                            (858) 534-2098
                                             Dept of Family/Preventive Medicine
E mailto:cberry at tajo.ucsd.edu	            UC San Diego
http://famprevmed.ucsd.edu/faculty/cberry/  La Jolla, San Diego 92093-0901