I am using R to do a loess normalisation procedure. In 1.5.1 I used the following commands to normalise the variable "logratio", over a 2d surface (defined by coordinates x and y):> array <- read.table("121203B_QCnew.txt", header=T, sep="\t") > array$logs555<-log(array$s555)/log(2) > array$logs647<-log(array$s647)/log(2) > array$logratio<-array$logs555-array$logs647 > array$logav<-(array$logs555+array$logs647)/2 > library(modreg) > loess2d<-loess(logratio~x+y,data=array) > array$logratio2DLoeNorm <-array$logratio - predict.loess(loess2d, array)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 ? Thomas
Thomas Jagoe wrote:> I am using R to do a loess normalisation procedure. > In 1.5.1 I used the following commands to normalise the variable "logratio", > over a 2d surface (defined by coordinates x and y): > > >>array <- read.table("121203B_QCnew.txt", header=T, sep="\t") >>array$logs555<-log(array$s555)/log(2) >>array$logs647<-log(array$s647)/log(2) >>array$logratio<-array$logs555-array$logs647 >>array$logav<-(array$logs555+array$logs647)/2 >>library(modreg) >>loess2d<-loess(logratio~x+y,data=array) >>array$logratio2DLoeNorm <-array$logratio - predict.loess(loess2d, array) > > > 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
You can't use this anymore. The function predict() has a method for loess objects, but there is no longer an available function called "predict.loess". So just replace "predict.loess" with "predict". On Fri, 13 Feb 2004, Thomas Jagoe wrote:> I am using R to do a loess normalisation procedure. > In 1.5.1 I used the following commands to normalise the variable "logratio", > over a 2d surface (defined by coordinates x and y): > > > array <- read.table("121203B_QCnew.txt", header=T, sep="\t") > > array$logs555<-log(array$s555)/log(2) > > array$logs647<-log(array$s647)/log(2) > > array$logratio<-array$logs555-array$logs647 > > array$logav<-(array$logs555+array$logs647)/2 > > library(modreg) > > loess2d<-loess(logratio~x+y,data=array) > > array$logratio2DLoeNorm <-array$logratio - predict.loess(loess2d, array) > > 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 ? > > Thomas > > ______________________________________________ > 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 >
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 LiggesWhy 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
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. 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}}
Other things one might want to ask: - what is the S3 generic corresponding to predict.loess? answer: predict - what are the other methods associated with that S3 generic? answer: methods(predict) - what are all the methods for a given S3 class? answer: apropos("[.]loess$") may find some of them but its not guaranteed to find all of them. In fact, in this case it does not find any. Date: Sat, 14 Feb 2004 11:27:11 -0500 From: Duncan Murdoch <dmurdoch at pair.com> To: Liaw, Andy <andy_liaw at merck.com> Cc: <r-help at stat.math.ethz.ch>, <ligges at statistik.uni-dortmund.de>,'Rolf Turner' <rolf at math.unb.ca> Subject: Re: [R] predict function On Sat, 14 Feb 2004 10:41:41 -0500, you 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.Or getAnywhere('predict.loess') or getS3method('predict','loess') (which are both good to know, because predict.loess won't be in modreg in 1.9, it's in the new "stats" package). Rolf said:>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!Things weren't so simple in the old days in cases where two packages both defined their own predict.loess functions, or when a user created a function named "c" or "t", or in lots of other situations of name collisions. When two things had the same name, problems were really likely to arise. The point of namespaces is to protect the code in packages from accidental name collisions. Packages with namespaces can safely use c() and t() and know what is going to happen. The decision not to export the name "predict.loess" follows from the general principle that you shouldn't export things unless you need to. You should be calling "predict". If you really need to call "predict.loess" and "predict" won't get you there, you need to jump through extra hoops to get it. Duncan Murdoch ______________________________________________ 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