Hi, I am trying to implement a new method for glm2 which allows the use of the Matrix package to work with large data.
I have added Matrix to Suggests, and when the new method is requested, the following check is performed: if (!requireNamespace("Matrix", quietly = TRUE)) { stop("Package \"Matrix\" must be installed to use method = \"glm.fit2.Matrix\".", call. = FALSE) } This works fine. However, I would like the user to be able to use summary.glm on the fitted object x, and it effectively calls chol2inv(x$qr$qr[1:p,1:p]), which fails if x$qr$qr is not a (small m) matrix: Error in chol2inv(Qr$qr[p1, p1, drop = FALSE]) : 'a' must be a numeric matrix I can return the matrix version of x$qr$qr, but this can be quite large and ideally I would like to return the Matrix version, and have summary.glm automatically call the Matrix version of chol2inv. I imagine this would require changing the search path, which I understand is not recommended, but I am not even sure how to go about it, or if there is another solution that wouldn't require a custom version of summary.glm. I also tried attachNamespace in a similar code block when glm.fit2.Matrix is called, but that did not work. Thanks in advance for any suggestions. Mark ______________________________________________ R-package-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-package-devel