[Rd] setGeneric?

Roger Koenker roger at ysidro.econ.uiuc.edu
Tue May 27 11:22:51 MEST 2003


In the last few days I've received  couple of messages pointing out that our SparseM
package fails to install on the patched version of 1.7.0.  Laurent Gaultier kindly
suggested that replacing:

setGeneric("as.matrix.csr")

by

setGeneric("as.matrix.csr", function(x, nrow, ncol, eps) standardGeneric("as.matrix.csr"))

was sufficient to fix the problem.  Unfortunately, the story is a bit more complicated
than that.  After this substitution and some similar ones for a few other setGeneric()
calls, the package fails R CMD check in the examples --
from the end of SparseM.Rcheck-Ex/SparseM.Rout:

> image(as.matrix.csr(A)%*%as.matrix.csr(t(B)))
Error in str(eps) : Argument "eps" is missing, with no default
Execution halted

This is the beginning of the function as.matrix.csr.  The cat(str(eps)) is there just
for debugging purposes, but it is quite mysterious to me how eps can be considered
missing with no default.  I tried without success to construct a simpler example of
this phenomena.  I would, as always, be  very grateful for any suggestions.

"as.matrix.csr" <-
function(x, nrow = 1, ncol = 1, eps = .Machine$double.eps){
         cat(str(eps))
         if(is.matrix.csr(x)) {x; return(x)}
         if (!is.matrix(x)) {
			..........

Roger

PS.  While I'm at it I might as well inquire why the def argument of setGeneric is
now needed since my reading of the its documentation suggests that it isn't needed
in the present circumstances.



url:	www.econ.uiuc.edu	Roger Koenker		Dept. of Economics UCL,
email	rkoenker at uiuc.edu	Department of Economics Drayton House,
vox: 	217-333-4558		University of Illinois	30 Gordon St,
fax:   	217-244-6678		Champaign, IL 61820	London,WC1H 0AX, UK
							vox:	020-7679-5838



More information about the R-devel mailing list