blue sky
2010-Feb-14 18:32 UTC
[Rd] How S3method() is implemented and called? And when to use it?
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.> S3methodError: object 'S3method' not found> ?S3methodNo 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
2010-Feb-14 18:41 UTC
[Rd] How S3method() is implemented and called? And when to use it?
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
Possibly Parallel Threads
- Portability of a C function
- [R-pkg-devel] Three-argument S3method declaration does not seem to affect dispatching from inside the package.
- namespace crash on S3method("as.ff",function)
- [R-pkg-devel] Three-argument S3method declaration does not seem to affect dispatching from inside the package.
- [R-pkg-devel] Three-argument S3method declaration does not seem to affect dispatching from inside the package.