From sfalcon at fhcrc.org  Mon Feb  6 20:21:53 2006
From: sfalcon at fhcrc.org (Seth Falcon)
Date: Mon, 06 Feb 2006 11:21:53 -0800
Subject: [Rd] match gets confused by S4 objects
Message-ID: <m2hd7cjnse.fsf@ziti.local>

If one accidentally calls match(x, obj), where obj is any S4 instance,
the result is NA.  

I was expecting an error because, in general, if a match method is not
defined for a particular S4 class, I don't know what a reasonable
default could be.  Specifically, here's what I see

setClass("FOO", representation(a="numeric"))
foo <- new("FOO", a=10)
match("a", foo)
[1] NA

And my thinking is that this should be an error, along the lines of
match("a", function(x) x)

Unless, of course, a specific method for match, table="FOO" has been
defined.

+ seth



[Rd] match gets confused by S4 objects
Seth Falcon