From: roger koenker <roger_at_ysidro.econ.uiuc.edu>

Date: Sat 27 Nov 2004 - 04:50:33 EST

https://stat.ethz.ch/mailman/listinfo/r-devel Received on Sat Nov 27 04:57:56 2004

Date: Sat 27 Nov 2004 - 04:50:33 EST

setClass("matrix.diag.csr","matrix.csr")

setAs("numeric","matrix.diag.csr",function(from){

if(length(from)==1){ n <- as.integer(from) if(n>0) from <- rep(1,n) else stop("Sparse identity matrices must have positive, integer dimension") } else n <- length(from) return(new("matrix.diag.csr", ra = from ,ja = as.integer(1:n), ia = as.integer(1:(n+1)), dimension = as.integer(c(n,n)))) })

This seemed to be fine. I could do,

A <- as(5,"matrix.diag.csr")

and A would be a 5x5 identity matrix in sparse form. But post-namespace I get:

so apparently using exportClass(matrix.diag.csr) isn't sufficient for
coerce to know what to do.

Using findClass("matrix.diag.csr") indicates that the class is
recognized to be from SparseM,

so my question is: is there some mechanism that I'm missing in the
NAMESPACE scheme

that would enable my old setAs() directive to work, or is there some
other suggestion on how

to proceed?

url: www.econ.uiuc.edu/~roger Roger Koenker email rkoenker@uiuc.edu Department of Economics vox: 217-333-4558 University of Illinois fax: 217-244-6678 Champaign, IL 61820 ______________________________________________R-devel@stat.math.ethz.ch mailing list

https://stat.ethz.ch/mailman/listinfo/r-devel Received on Sat Nov 27 04:57:56 2004

*
This archive was generated by hypermail 2.1.8
: Fri 18 Mar 2005 - 09:01:46 EST
*