[R] document setReplaceMethod
Jennifer Lai
lai at lindaspaces.com
Fri Apr 28 15:20:52 CEST 2006
Thanks, Martin! It worked. With other methods I didn't have to quote the
function name to export them in the NAMESPACE file. But with
replaceMethod, I have to quote the function name without getting any
error during package build time. Thanks!
Regards,
Jennifer
Martin Maechler wrote:
>>>>>>"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
>
>
You are right. It was a typo.
> 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