[R] Use and misuse of "update" function for non-models. Any views/recommendations??
Gavin Simpson
gavin.simpson at ucl.ac.uk
Tue Nov 20 17:18:50 CET 2007
On Tue, 2007-11-20 at 16:32 +0100, Søren Højsgaard wrote:
> Thanks, Luke Tierney - the documentation of update was exactly what
> prompted my question. Yet, I conclude that writing an update.myobject
> method is OK.
I think Luke's point was that whilst it would be OK if you wrote your
own method in as much as you wouldn't be breaking anything, you may
confuse people by having a method do one thing for one class of object
and something totally different for another class of object - this is
what I believe you are planning. Some may view this as not being OK.
Perhaps it would be better to choose a slightly different name, say
Update(), but that might be just as confusing! Or perhaps choose another
word that has the same meaning as update and one such candidate would be
amend().
Just a thought,
G
> Regards
> Søren
>
>
>
>
> ________________________________
>
> Fra: Luke Tierney [mailto:luke at stat.uiowa.edu]
> Sendt: ti 20-11-2007 14:54
> Til: Prof Brian Ripley
> Cc: Søren Højsgaard; r-help at stat.math.ethz.ch
> Emne: Re: [R] Use and misuse of "update" function for non-models. Any views/recommendations??
>
>
>
> On Tue, 20 Nov 2007, Prof Brian Ripley wrote:
>
> > update() is generic, so the recommended approach would be to write a method
> > for your objects.
> >
> > Creating your own function update() in a package would probably not break too
> > much, as namespaces would protect most functions using the generic in stats.
> > But it could be very confusing to users.
>
> Maybe. update is generic with a netral set of argument names; on the
> other hand, the _documentation_ of update is not generic -- it is
> specific to updating models. So there is opportunity for confusion
> from that direction.
>
> Best,
>
> luke
>
> >
> > On Tue, 20 Nov 2007, Søren Højsgaard wrote:
> >
> >> Dear all,
> >>
> >> I wonder if it is "bad style" (or something worse) to create an "update"
> >> function which does not work on model objects of the lm, glm etc. type.
> >> Specifically, I have some graph objects (graphs as mathematical objects,
> >> not as displays) which I want to alter and for that purpose I thought of
> >> writing an update function. Would doing so violate a "deeper philosophy" in
> >> the R system or have other unfortunate consequences. If so, I'm happy to
> >> hear other suggestions...
> >>
> >> Regards
> >> Søren
> >>
> >> ______________________________________________
> >> R-help at r-project.org mailing list
> >> https://stat.ethz.ch/mailman/listinfo/r-help
> >> PLEASE do read the posting guide
> >> http://www.R-project.org/posting-guide.html
> >> and provide commented, minimal, self-contained, reproducible code.
> >>
> >
> >
>
> --
> Luke Tierney
> Chair, Statistics and Actuarial Science
> Ralph E. Wareham Professor of Mathematical Sciences
> University of Iowa Phone: 319-335-3386
> Department of Statistics and Fax: 319-335-3017
> Actuarial Science
> 241 Schaeffer Hall email: luke at stat.uiowa.edu
> Iowa City, IA 52242 WWW: http://www.stat.uiowa.edu <http://www.stat.uiowa.edu/>
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
--
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
Dr. Gavin Simpson [t] +44 (0)20 7679 0522
ECRC, UCL Geography, [f] +44 (0)20 7679 0565
Pearson Building, [e] gavin.simpsonATNOSPAMucl.ac.uk
Gower Street, London [w] http://www.ucl.ac.uk/~ucfagls/
UK. WC1E 6BT. [w] http://www.freshwaters.org.uk
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
More information about the R-help
mailing list