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

2010-02-14 Thread blue sky
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?

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


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

2010-02-14 Thread Romain Francois

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

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel