[R] Fwd: generic methods - in particular the summary function

Uwe Ligges ligges at statistik.tu-dortmund.de
Sun Sep 27 19:04:51 CEST 2009



Christophe Dutang wrote:
> Nobody wants to answer my question... is there something stupid in it?

Maybe, or maybe just too much traffic on the lists these days.


> Début du message réexpédié :
> 
>> De : Christophe Dutang <dutangc at gmail.com>
>> Date : 19 septembre 2009 11:26:51 HAEC
>> À : r-help at r-project.org
>> Objet : generic methods - in particular the summary function
>>
>> Hi all,
>>
>> I'm currently working on the fitdistrplus package (that basically  
>> fit distributions). There is something I do not understand about the  
>> generic function summary.
>>
>> In the current version on CRAN, there is no NAMESPACE saying
>>
>> S3method(summary, fitdist)
>>
>> .
>> However if we use summary on an object send by fitdist function it  
>> works fine...

Yes, because your package's CRAN version does not have any namespace at 
all, hence nothing can be hidden in it.



>> According to R-lang, we have
>> "
>> The most common use of generic functions is to provide print and  
>> summary methods for
>> statistical ob jects, generally the output of some model fitting  
>> process. To do this, each model
>> attaches a class attribute to its output and then provides a special  
>> method that takes that output
>> and provides a nice readable version of it. The user then needs only  
>> remember that print or
>> summary will provide nice output for the results of any analysis.
>> "
>>
>> I would like to be sure, that if the summary.fitdist is not exported  
>> in the NAMESPACE, then we must use declare it with S3method.

Right, and that's the way you should do it if you have a namespace (do 
not export the function but declare it as an S3 method). And yes, it is 
a good idea to add a namespace.

Best,
Uwe Ligges



>>
>> Thanks in advance
>>
>> Christophe
>>
>> --
>> Christophe Dutang
>> Ph.D. student at ISFA, Lyon, France
>> website: http://dutangc.free.fr
>>
> 
> --
> Christophe Dutang
> Ph.D. student at ISFA, Lyon, France
> website: http://dutangc.free.fr
> 
> 
> 
> 
> 
> 
> 
> 	[[alternative HTML version deleted]]
> 
> 
> 
> ------------------------------------------------------------------------
> 
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.




More information about the R-help mailing list