[R] document setReplaceMethod

Martin Maechler maechler at stat.math.ethz.ch
Fri Apr 28 12:06:13 CEST 2006


>>>>> "Jennifer" == Jennifer Lai <lai at lindaspaces.com>
>>>>>     on Thu, 27 Apr 2006 15:36:04 -0400 writes:

    Jennifer> Hi,
    Jennifer> How do I document setReplaceMethod, such as this,

    Jennifer> setGeneric("x<-", function(.Object, value)
    Jennifer>			standardGeneric("myMethod<-"))

the above looks wrong.
I assume you want

 setGeneric("x<-", function(.Object, value) standardGeneric("x<-"))

??

    Jennifer> setReplaceMethod("x", "myClass",
    Jennifer>   function(.Object, value) {
    Jennifer>  .Object at x <- value
    Jennifer>  .Object
    Jennifer> }
    Jennifer> )

    Jennifer> in the NAMESPACE file?

well,  the NAMESPACE is not for documentation, but for importing
and exporting of R symbols (or "objects" if you like).

So I assume you that you want to make

    x(........) <- ........

abvailable, i.e. export it?
I didn't try, but I think 
  
   exportMethods("x<-") # name of the generic, as with other methods

should work.

Regards,
Martin Maechler, ETH Zurich




More information about the R-help mailing list