[R] How to write a package based on nlme

Dieter Menne dieter.menne at menne-biomed.de
Mon May 26 08:52:43 CEST 2008


 <ctu <at> bigred.unl.edu> writes:

> I try to write a small package that based on nlme however my code does  
> not work.
> R always appears this message:
> Error in eval(expr, envir, enclos) : object "y" not found
> where y is the response variable. Please help me out!
> This is my code:

... Code removed 

> Error in eval(expr, envir, enclos) : object "y" not found
> 

It has to do with mixing data passing by data frame and by parameters, and
possibly also with the use of grouped data. However, the code is much to complex
to be easily debugged. May I suggest that you 

-- remove grouped data. nlme works fine and much more transparent without these
(this is a bit confusing in Pinheiro/Bates).
-- try to make the lines shorter by manually inserting line breaks, since forced
line breaks in email makes it difficult to reassemble the pieces.
-- Prune the code in the complex function down to the absolute minimum to show
the problem, by removing 3 of your 4 cases, and by removing all code after the
problem showed up.
-- make it easier to test the example by removing the > in front of each line.
You could even provide the data on some website, for example

ge = read.table("http://www.menne-biomed.de/gastempt/gastempt.csv",
   sep=",",header=TRUE)

Dieter



More information about the R-help mailing list