From: Ross Boylan <ross_at_biostat.ucsf.edu>

Date: Fri 03 Jun 2005 - 07:44:09 EST

setMethod("likelihood",

Date: Fri 03 Jun 2005 - 07:44:09 EST

I tried the following (relevant excerpt only)
setMethod("likelihood",

signature(spec="Specification", covs="vector", states="vector"), function(spec, covs, states) {####

setMethod("likelihood",

signature(model="Model", path="matrix"), function(model, path) {

This fails with the message

arguments in definition changed from (spec) to (object)
Error in match.call(fun, fcall) : unused argument(s) (model ...)

I'll note in passing that it would be helpful to have a line number for the error, and that the error didn't mean much to me.

After study, my guess is that generics are not supposed to work this way. All the definitions need to have the same named arguments (exceptions: some can be "missing", and ... is allowed). So the error above is a complaint that my second signature uses different names (or is it different classes?). And the "unused argument" is triggered by the fact that the original signature had 3 args named spec, covs, and states, and the new signature has none of them. Is that about right?

It looks as if I might get away by not naming the arguments, so the first signature could be signature("Specification", "vector", "vector") and the 2nd signature("Model", "matrix", "missing").

Among other problems, the lack of identifiers makes the semantics of the signature obscure in this case.

Basically, would it be advisable to use different generic names for the two functions listed above?

-- Ross Boylan wk: (415) 502-4031 530 Parnassus Avenue (Library) rm 115-4 ross@biostat.ucsf.edu Dept of Epidemiology and Biostatistics fax: (415) 476-9856 University of California, San Francisco San Francisco, CA 94143-0840 hm: (415) 550-1062 ______________________________________________ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.htmlReceived on Fri Jun 03 07:49:27 2005

*
This archive was generated by hypermail 2.1.8
: Fri 03 Mar 2006 - 03:32:22 EST
*