Re: [R] probelem of function inside function

2003-06-25 Thread Prof Brian Ripley
On Wed, 25 Jun 2003, array chip wrote: > Actually, It is the question I encountered in S-Plus. > Sorry that I forgot to mention. As Simon just pointed > out, the function works fine in R (Thanks!). But in > any case, does anyone know how to solve the problem in > S-Plus? Assign to frame 1: see `S

Re: [R] probelem of function inside function

2003-06-25 Thread array chip
Actually, It is the question I encountered in S-Plus. Sorry that I forgot to mention. As Simon just pointed out, the function works fine in R (Thanks!). But in any case, does anyone know how to solve the problem in S-Plus? Thanks --- Thomas Lumley <[EMAIL PROTECTED]> wrote: > On Wed, 25 Jun 2003

Re: [R] probelem of function inside function

2003-06-25 Thread Thomas Lumley
On Wed, 25 Jun 2003, array chip wrote: > Hi, > > I encountered a problem when I am trying to write my > own function which contains another function. To > simplify a problem, I tried the following simplified > function, hope someone can idenfity the problem for > me. > > > f.fun(var='x',fdata=tes

RE: [R] probelem of function inside function

2003-06-25 Thread Simon Blomberg
Your function works fine for me (R 1.7.1, Windows 2000): > library(MASS) > testdata<-data.frame(cbind(x=c(129,109,52,118,217,278,606,198,99,133),y=c(89,118,99,137,34,14,130,30,131,30))) > f.fun<-function(var,fdata) { + fdata<-data.frame(fdata) + fit<-lm(y~1,data=fdata) + + f.add