[R] predict function

John Fox jfox at mcmaster.ca
Sat Feb 14 17:30:32 CET 2004


Dear Roft and Andy,

At 10:41 AM 2/14/2004 -0500, Liaw, Andy wrote:
>If you know what you're looking for, you can always get to non-exported
>function by using :::, e.g., modreg:::predict.loess will give you the
>function.

and getS3method("predict", "loess") or getAnywhere("predict.loess") will 
retrieve the function without specifying where it resides.

I'm sure that opinions are divided (and perhaps the current implementation 
could be improved), but I like the namespace mechanism: Namespaces give a 
package author the ability to create objects without (inadvertently) 
shadowing objects of the same names in other packages, and the ability to 
shadow objects intentionally that are (potentially) in locations higher on 
the search path. To my mind, the traditional flat namespace in R was a 
liability.

Regards,
  John

>Andy
>
> > From: Rolf Turner
> >
> > Uwe Ligges wrote:
> >
> > > Thomas Jagoe wrote:
> > >
> > > > I am using R to do a loess normalisation procedure.
> >     .
> >     .
> >     .
> > > > However in 1.8.1 all goes well until the last step when I
> > get an error:
> > > >
> > > > Error: couldn't find function "predict.loess"
> > > >
> > > > Can anyone help ?
> > >
> > >
> > > Use predict() instead of predict.loess() (the method is hidden in a
> > > namespace, you should use the generic function).
> > >
> > > Uwe Ligges
> >
> > Why are the developers ***DOING*** these things to us?
> >
> > It used to be so simple and straightforward!  If I wanted to look
> > at an object, including a function object, I typed its name.  Now
> > I get hand-cuffed by this ``namespace'' business!  I will wager
> > Euros to doughnuts that no-one apart from the developers has a clue
> > what a ``namespace'' is, much less what it is good for.  Whatever
> > problem ``namespaces'' were introduced to solve, it pales by
> > comparison with the handicaps they introduce.
> >
> > It's classic tail-wagging-the-dog syndrome.
> >
> > When I get errors from R code, which come from within ``system''
> > functions, it has been my practice to make a local copy (in the
> > .Globalenv) of the function, stick in calls to browser(), and
> > thereby track down what's going on/wrong.  This always worked like a
> > charm. Now if the problem arises within, e.g. predict.loess, I'm
> > stuffed.
> >
> >                                       cheers,
> >
> >                                               Rolf Turner
> >                                               rolf at math.unb.ca
> >
> > ______________________________________________
> > R-help at stat.math.ethz.ch mailing list
> > https://www.stat.math.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide!
> > http://www.R-project.org/posting-guide.html
> >
> >
>
>
>------------------------------------------------------------------------------
>Notice:  This e-mail message, together with any attachments,...{{dropped}}
>
>______________________________________________
>R-help at stat.math.ethz.ch mailing list
>https://www.stat.math.ethz.ch/mailman/listinfo/r-help
>PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

-----------------------------------------------------
John Fox
Department of Sociology
McMaster University
Hamilton, Ontario, Canada L8S 4M4
email: jfox at mcmaster.ca
phone: 905-525-9140x23604
web: www.socsci.mcmaster.ca/jfox




More information about the R-help mailing list