I'm working on the next version of coxme, one step of which is converting the bdsmatrix library from Splus to R. Actually, it is a conversion from S4 methods as first described in the Green book to S4 methods as they currently exist. Mostly it's going ok, but not entirely. 1. The biggest issue is lack of documentation. The online help pages have not been a help; they keep saying it's "as found in the green book - almost". I've looked for the package on CRAN in the hopes for more there, but can't find it. Perchance there is something obvious that I am missing? 2. The changes are small but numerous. The current one that has me puzzled is a method for addition: setMethod(Ops, signature=c('numeric', 'bdsmatrix'), .... Let xmat be ordinary and bmat be a bdsmatrix. In the old code "xmat + bmat" fell to this method (which knows what to do), in the current R I get failure due to no method found. is.numeric(xmat) is TRUE. What is the fix? 3. In the green book the examples used .Dim and .Dimnames slots, the Matrix library uses Dim and Dimnames. Is there a good reason to choose one or the other? I'll be out of town for the next few days (son's wedding) so instant response is not necessary. Terry Therneau
Terry Therneau wrote:> I'm working on the next version of coxme, one step of which is converting > the bdsmatrix library from Splus to R. Actually, it is a conversion from > S4 methods as first described in the Green book to S4 methods as they > currently exist. Mostly it's going ok, but not entirely. > > 1. The biggest issue is lack of documentation. The online help pages have > not been a help; they keep saying it's "as found in the green book - almost". > I've looked for the package on CRAN in the hopes for more there, but can't > find it. Perchance there is something obvious that I am missing? > > 2. The changes are small but numerous. The current one that has me puzzled > is a method for addition: > setMethod(Ops, signature=c('numeric', 'bdsmatrix'), .... > > Let xmat be ordinary and bmat be a bdsmatrix. In the old code "xmat + bmat" > fell to this method (which knows what to do), in the current R I get > failure due to no method found. is.numeric(xmat) is TRUE. > What is the fix?Assuming xmat to be a numeric matrix e.g. diag(n). S4 inheritance will be determined by is() and is(xmat, "numeric") will be FALSE So one solution is to provide explicit methods for signature 'matrix' i.e. setMethod(Ops, signature=c('matrix', 'bdsmatrix'), .... setMethod(Ops, signature=c('bdsmatrix', 'matrix'), .... Matthias> 3. In the green book the examples used .Dim and .Dimnames slots, the Matrix > library uses Dim and Dimnames. Is there a good reason to choose one or the > other? > > I'll be out of town for the next few days (son's wedding) so instant response > is not necessary. > > Terry Therneau > > ______________________________________________ > R-devel at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel >-- Matthias Burger Project Manager/ Biostatistician Epigenomics AG Kleine Praesidentenstr. 1 10178 Berlin, Germany phone:+49-30-24345-0 fax:+49-30-24345-555 http://www.epigenomics.com matthias.burger at epigenomics.com -- Epigenomics AG Berlin Amtsgericht Charlottenburg HRB 75861 Vorstand: Geert Nygaard (CEO/Vorsitzender) Oliver Schacht PhD (CFO) Aufsichtsrat: Prof. Dr. Dr. hc. Rolf Krebs (Chairman/Vorsitzender)
Hi Terry, Terry Therneau wrote:> I'm working on the next version of coxme, one step of which is converting > the bdsmatrix library from Splus to R. Actually, it is a conversion from > S4 methods as first described in the Green book to S4 methods as they > currently exist. Mostly it's going ok, but not entirely. > > 1. The biggest issue is lack of documentation. The online help pages have > not been a help; they keep saying it's "as found in the green book - almost". > I've looked for the package on CRAN in the hopes for more there, but can't > find it. Perchance there is something obvious that I am missing? >Well, one is that there is a 2008 book, "Software for Data Analysis", that I wrote partly to describe this and other topics from an R perspective. It's a reference on most pages of documentation related to methods (in R version 2.8.1; you should be using that and/or the r-devel version if you're revising a package). John> 2. The changes are small but numerous. The current one that has me puzzled > is a method for addition: > setMethod(Ops, signature=c('numeric', 'bdsmatrix'), .... > > Let xmat be ordinary and bmat be a bdsmatrix. In the old code "xmat + bmat" > fell to this method (which knows what to do), in the current R I get > failure due to no method found. is.numeric(xmat) is TRUE. > What is the fix? > > 3. In the green book the examples used .Dim and .Dimnames slots, the Matrix > library uses Dim and Dimnames. Is there a good reason to choose one or the > other? > > I'll be out of town for the next few days (son's wedding) so instant response > is not necessary. > > Terry Therneau > > ______________________________________________ > R-devel at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel > >