Your example appears to use anova, despite two claims to use summary.
Yes, it is a scoping issue, and you need to assign data1 in frame 1.
See `S Programming' or another good book on that subject.
On Mon, 16 Jan 2006, yiwu ye wrote:
Dear list,
I wrote a function to fit a GLM model for a series of data. In order to
know the analysis of deviance table, I used print(summary(GLM-model))
in the function.
glm.fit<-function(data=data, a=a,b=b)
{
data1<-cbind(data, a^b) # some function creates a new data frame
fit_glm(...., data=data1)
print(anova(fit,test="Chi"))
}
when execute the above funciton, I got the following error message:
Problem in eval(oc,list()):Object"data1" not found. Use traceback() to see the
call stack.
It is probably a scoping problem. Could any one help with this?
Thanks very much
Yiwu
--
Brian D. Ripley, ripley@stats.ox.ac.uk
Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel: +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UK Fax: +44 1865 272595
|