Displaying 3 results from an estimated 3 matches for "mixeddat".
2004 Feb 23
0
Question concerning functions nlsList and nlme from nlme R library.
I hope that the mailing list is the correct forum for the question below. I
have trouble calling functions nlsList and nlme from
another function. Any help would be greatly appreciated.
Jens Praestgaard
Human Genome Sciences
Rockville MD.
I have a data set v with two components, v$mixeddat and v$init. They are
listed below:
> v$mixeddat
conc result rep sample z
11 20.00000000 11141 1 vial 1 0
12 5.00000000 11446 1 vial 1 0
13 1.25000000 13377 1 vial 1 0
14 0.31250000 20267 1 vial 1 0
15 0.07812500 48852 1 vial 1 0
16 0.01953125 118507 1 vial...
2004 Mar 10
1
Question concerning library function "nlme" and lexical scoping
...am running into problems calling the library function nlme from within
another function. Basically,the following function (with v a list
containing data and initialization values)
> 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))
}
produces the error message
Error in eval(expr, envir, enclos) : Object "dat" not found.
However, if the assignment dat<-v is done globally, then testfunc()
produces the desired mixed model analysis.
As I understand lexical scoping, the nlme function...
2004 Mar 23
1
nlme question
...e 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[["da...