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


______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel

Reply via email to