[Rd] question about trailing arguments in an S4 method
Ben Bolker
bolker at zoo.ufl.edu
Sat Dec 16 20:20:17 CET 2006
I'm trying to add arguments to the AIC method
for some classes -- things like
weights=TRUE to calculate AIC weights
corr=TRUE, nobs to calculate AICc
delta=TRUE to put a delta-AIC column in the output.
The problem is that AIC is defined as
AIC(object, ..., k=2) where k is the constant associated
with the penalty term and ... is a list of objects
that will have their AICs calculated and listed.
Thus I'm not allowed (I think) to extend the definition to
AIC(object, ..., nobs, corr=FALSE, delta=FALSE, weights=FALSE, k=2)
An ugly solution to this is to go through the ... list and
pull out the values of any of the other arguments I want, and
then set them to NULL, leaving the list composed only of
additional objects to calculate the AIC for. But it seems
really ugly ...
Any ideas for a better way to do this would be
appreciated. (Please be gentle if possible, I'm a bit out
of my depth with S4 ...)
cheers
Ben Bolker
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 254 bytes
Desc: OpenPGP digital signature
Url : https://stat.ethz.ch/pipermail/r-devel/attachments/20061216/4cd5425d/attachment.bin
More information about the R-devel
mailing list