Registered S3 methods not found: Documentation bug or anomaly in function update or ... ?

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Registered S3 methods not found: Documentation bug or anomaly in function update or ... ?

Ulrike Grömping
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 *
* [hidden email] *

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Reply | Threaded
Open this post in threaded view
|

Re: Registered S3 methods not found: Documentation bug or anomaly in function update or ... ?

Uwe Ligges-3
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
>

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Reply | Threaded
Open this post in threaded view
|

Re: Registered S3 methods not found: Documentation bug or anomaly in function update or ... ?

Ulrike Grömping
Ah, thanks, now I understand the mode of operation and will work on a more robust fix than exporting the functions.

Regards, Ulrike

---------- Original Message -----------
From: Uwe Ligges <[hidden email]>
To: Ulrike Grömping <[hidden email]>
Cc: [hidden email]
Sent: Wed, 04 Nov 2009 12:19:59 +0100
Subject: Re: [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
> >
------- End of Original Message -------
 

        [[alternative HTML version deleted]]


______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel