I have a need to call and pass arguments to nlme() from within another function. I use R version 1.8. I have found an apparent way to make this work, but I would appreciate some comments on whether this fix is really appropriate, or there is another way to do it that does not involve changing the source code. I don't have enough experience to start changing the sorurce code of a library function.
Calling nlme from within a function as done below will give an error: testfunc<- function(dat=v) { test<-nlsList(result~a+(b-a)/(1+(conc/(c+z*cdiff))^d) |rep,start=dat$init,data=dat$mixeddat) return(nlme(test,random=b~1)) } Here, v is an appropriate data frame in the main workspace. Inserting two lines in nlme.nlsList will fix it: Replacing line 21 from bottom "mData<-eval(mData) " by " mData <- eval(mData,parent.frame())" Inserting thisCall[["data"]]<-mData on line 4 from bottom before val <- do.call("nlme.formula", thisCall) Doing this makes nlme.nlsList recognize the input data of the regression. But is there a way to do this without changing the source code? Thank you in advance ______________________________________________ [EMAIL PROTECTED] 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