[Rd] setGeneric?

John Chambers jmc at research.bell-labs.com
Tue May 27 12:48:28 MEST 2003

Hmm.  Unfortunately (perhaps) it seems to work for me, with the current
R-patched and with the 0.27 version of SparseM from CRAN, I could
install and also run CMD check w/o error.

(This has the simpler version , setGeneric("as.matrix.csr"), which would
seem to me to be what you want.)

Could you try again, and send me the SparseM.Rcheck/SparseM-Ex.Rout*
files if it still fails?


Roger Koenker wrote:
> 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
> ______________________________________________
> R-devel at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-devel

John M. Chambers                  jmc at bell-labs.com
Bell Labs, Lucent Technologies    office: (908)582-2681
700 Mountain Avenue, Room 2C-282  fax:    (908)582-3340
Murray Hill, NJ  07974            web: http://www.cs.bell-labs.com/~jmc

More information about the R-devel mailing list