[Rd] setGeneric?
John Chambers
jmc at research.bell-labs.com
Tue May 27 15:16:48 MEST 2003
Roger Koenker wrote:
>
> John,
>
> I updated to the current R-patched and now SparseM_0.27 seems to be fine. The
> reports I had received complained about:
>
> > > R CMD INSTALL SparseM_0.27.tar.gz -l /usr/local/r-cran/
> > > dies with:
> > > [1] "summary.slm"
> > > Error in setGeneric("as.matrix.csr") : Must supply a function skeleton, explicitly or via
> an existing function
> > > Execution halted
This is the message one would get if there was no ordinary as.matrix.csr
function visible when the setGeneric call occurred.
In your source, you assign as.matrix.csr in R/SparseM.R, but if someone
contrived to run R/SparseM_Methods.R first, that's the error you would
see.
>
> but it looks fine with the original version of SparseM now...so either this was something
> machine specific -- or something that only arose in some intermediate version of R-patched.
My guess would be neither of the above, rather the dependency on
ordering (and hence on the alphabetic names of the files in the
SparseM/R directory). You can reproduce the error by
cd SparseM/R
mv SparseM_Methods.R ASparseM_Methods.R
and then doing the INSTALL.
(Suggests that good practice would be to define an ordinary function
version of something just before turning it into a generic.)
John
John
>
> Thanks for looking at it,
>
> Roger
>
> 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
>
> On Tue, 27 May 2003, John Chambers wrote:
>
> > 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?
> >
> > Thanks,
> > John
> >
> > 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
> >
--
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