From ross at biostat.ucsf.edu  Fri Oct 23 05:06:59 2009
From: ross at biostat.ucsf.edu (Ross Boylan)
Date: Thu, 22 Oct 2009 20:06:59 -0700
Subject: [Rd] mysteriously persistent generic definition
Message-ID: <1256267219.30505.148.camel@corn.betterworld.us>

Originally I made a function yearStop that took an argument "object".  I
made a generic, but later changed the argument to "x".  R keeps
resurrecting the old definition.  Could anyone explain what is going on,
or how to fix it?  Note particularly the end of the transcript below: I
remove the generic, verify that the symbol is undefined, make a new
function, and then make a generic.  But the generic does not use the
argument of the new function definition.

<quote>
> args(yearStop)
function (obj) 
NULL
> yearStop <- function(x) x at yearStop
> args(yearStop)
function (x) 
NULL
> setGeneric("yearStop")
[1] "yearStop"
> args(yearStop)
function (obj) 
NULL
> removeGeneric("yearStop")
[1] TRUE
> args(yearStop)
Error in args(yearStop) : object "yearStop" not found
> yearStop <- function(x) x at yearStop
> setGeneric("yearStop")
[1] "yearStop"
> args(yearStop)
function (obj) 
NULL
</quote>

R 2.7.1.  I originally read the definitions in from a file with ^c^l in
ESS; however, I typed the commands above by hand.

Thanks.
Ross Boylan



[Rd] mysteriously persistent generic definition
Ross Boylan