From rpeng at jhsph.edu  Mon Jan  5 16:54:16 2004
From: rpeng at jhsph.edu (Roger D. Peng)
Date: Mon Jan  5 16:53:40 2004
Subject: [Rd] non-generic functions
In-Reply-To: <OF75BDC5D8.88BD3A60-ON85256E12.0050FA52@bd.com>
References: <OF75BDC5D8.88BD3A60-ON85256E12.0050FA52@bd.com>
Message-ID: <3FF988A8.6070700@jhsph.edu>

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@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@stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-devel
>


[Rd] non-generic functions
Roger D. Peng