From romain at r-enthusiasts.com  Sun Feb 14 19:41:08 2010
From: romain at r-enthusiasts.com (Romain Francois)
Date: Sun, 14 Feb 2010 19:41:08 +0100
Subject: [Rd] How S3method() is implemented and called? And when to use
 it?
In-Reply-To: <48413fa11002141032g1a21d93eg9ce33be7bfb534e9@mail.gmail.com>
References: <48413fa11002141032g1a21d93eg9ce33be7bfb534e9@mail.gmail.com>
Message-ID: <4B7843C4.8060703@r-enthusiasts.com>

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



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