[R] Why does a custom function called is.numeric.factor break lattice?

Duncan Murdoch murdoch.duncan at gmail.com
Mon Nov 16 16:42:58 CET 2015


On 16/11/2015 10:22 AM, Bert Gunter wrote:
> There is no multiple dispatch; just multiple misunderstanding.
>
> The generic function is "is.numeric" . Your method for factors is
> "is.numeric.factor".
>
> You need to re-study.


I think the problem is with S3.  "is.numeric.factor" could be a 
"numeric.factor" method for the "is" generic, or a "factor" method for 
the "is.numeric" generic.  Using names with dots is a bad idea. This 
would be all be simpler and less ambiguous if the class had been named 
"numeric_factor" or "numericFactor" or anything without a dot.

Duncan Murdoch



More information about the R-help mailing list