[Rd] non-generic functions

Roger D. Peng rpeng at jhsph.edu
Mon Jan 5 16:54:16 MET 2004


If you use S4 classes/methods you can "create" generics by just calling

setGeneric("sd")

for example, and the original function becomes the default method.  Then 
you can define appropriate methods for your objects.

-roger

Max_Kuhn at bd.com wrote:
> Hi,
> 
> I'm writing some code that will eventually see its way to a package (I
> hope). I've noticed that some functions are not set up using generic
> methods (while similar functions are). For example, mean is a generic
> method but var is not. Other operations that I've come across that could
> benefit from being generic are: qqplot, cor, cov, optimize/optimise.
> 
> For example, if one were developing a control charting package, it be great
> to simply use sd(object), where object is of course the appropriate class,
> to get the standard deviation of the process as estimated be the charting
> method. Similarly, a DOE package might include optimize(object) to find the
> optimal operating conditions based on the data and specifications in
> object.
> 
> Just a thought,
> 
> Max
> 
> 
> 
> **********************************************************************
> This message is intended only for the designated recipient(s...{{dropped}}
> 
> ______________________________________________
> R-devel at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-devel
>



More information about the R-devel mailing list