Ulrike Grömping
2009-Nov-03 20:42 UTC
[Rd] Registered S3 methods not found: Documentation bug or anomaly in function update or ... ?
Dear expeRts, I recently asked for help on an issue with S3 methods for lm. The issue was (in DoE.base 0.9-4) that function update from package stats would return an error whenever DoE.base was loaded, complaining that lm.default was not found (e.g. require(DoE.base) swiss.lm <- lm(Fertility~Education+Examination, swiss) upd.swiss.lm <- update(swiss.lm, .~.-Examination) ). In version 0.9-4 of DoE.base, I had followed the recommendations of Section 1.6.2 of "Writing R extensions", exporting the generic function lm and registering the methods (lm.design and lm.default) with S3method but not separately exporting them in the namespace file. Not having received help fast, I decided to try to explicitly export the method functions lm.design and lm.default. This did in fact remove the issue with not finding lm.default when using function update, and I have uploaded this fixed version as 0.9-5. Is it generally advisable to also export the method functions (i.e. should section 1.6.2 of "Writing R extensions" be revised) ? Or is there an anomaly in function update ? Or ...? Explanations are appreciated. Thanks and regards, Ulrike -- *********************************************** * Ulrike Groemping * * BHT Berlin - University of Applied Sciences * *********************************************** * +49 (30) 39404863 (Home Office) * * +49 (30) 4504 5127 (BHT) * *********************************************** * http://prof.tfh-berlin.de/groemping * * groemping at bht-berlin.de *
Uwe Ligges
2009-Nov-04 11:19 UTC
[Rd] Registered S3 methods not found: Documentation bug or anomaly in function update or ... ?
Well, > swiss.lm Call: lm.default(formula = Fertility ~ Education + Examination, data = swiss) That means the call is registered as lm.default and update calls that one (and it is hidden in your namespace. You can fix it on your side so that the call is registered as lm(.....) in the lm object. Anyway, I think it is a bit dangerous to redefine lm() the way you did it. Best wishes, Uwe Ulrike Gr?mping wrote:> Dear expeRts, > > I recently asked for help on an issue with S3 methods for lm. The issue > was (in DoE.base 0.9-4) > that function update from package stats would return an error whenever > DoE.base was loaded, > complaining that lm.default was not found > (e.g. > require(DoE.base) > swiss.lm <- lm(Fertility~Education+Examination, swiss) > upd.swiss.lm <- update(swiss.lm, .~.-Examination) > ). > > In version 0.9-4 of DoE.base, I had followed the recommendations of > Section 1.6.2 of "Writing R > extensions", exporting the generic function lm and registering the > methods (lm.design and lm.default) > with S3method but not separately exporting them in the namespace file. > Not having received help fast, I decided to try to explicitly export the > method functions > lm.design and lm.default. This did in fact remove the > issue with not finding lm.default when using function update, and I have > uploaded this fixed version > as 0.9-5. > > Is it generally advisable to also export the method functions (i.e. > should section > 1.6.2 of "Writing R extensions" be revised) ? Or is there an anomaly in > function update ? Or ...? > Explanations are appreciated. > > Thanks and regards, Ulrike >