[Rd] How S3method() is implemented and called? And when to use it?

Romain Francois romain at r-enthusiasts.com
Sun Feb 14 19:41:08 CET 2010


Hello `Blue Sky` ,

Will you please start posting under your real name.

As documented in WRE, S3method is meant for use in namespaces:
http://cran.r-project.org/doc/manuals/R-exts.html#Registering-S3-methods

It is not an R function.

Romain

On 02/14/2010 07:32 PM, blue sky wrote:
>
> R-exts.pdf discribes S3method a little bit. But I want to understand
> more on how it is called, implemented and when to use it.
>
> I don't find it in an R session. But I see S3method() in some NAMESPACE files.
>
>> S3method
> Error: object 'S3method' not found
>> ?S3method
> No documentation for 'S3method' in specified packages and libraries:
> you could try '??S3method'
>
>
>
> I don't understand why S3method is necessary.
>
> My understanding is that we can always use
> print.foo(<something) {<function body>} # and appropriate exporting
> to replace
> S3method(print, foo)
> , right?
>
> Or I misunderstand something?


-- 
Romain Francois
Professional R Enthusiast
+33(0) 6 28 91 30 30
http://romainfrancois.blog.free.fr
|- http://tr.im/O1wO : highlight 0.1-5
|- http://tr.im/O1qJ : Rcpp 0.7.6
`- http://tr.im/NrTG : Rcpp 0.7.5



More information about the R-devel mailing list