Hi everybody, I wrote a function where several variables are created, and the used in a generalized mixed model, from the glmmADMB package.
here is part of the function: <deleted lines where ni, spx and spy are created> print(length(spy)) uu<-summary(glmmadmb(spy~sex+poswing+spx+(1|host),data=ni, family="nbinom",zeroInflation=True)) when I run the function I get [1] 596 Error in eval(expr, envir, enclos) : object 'spy' not found (so spy is known to the function "print" but not to the function glmmadmb) now I modify my function: <deleted lines where ni, spx and spy are created> print(length(spy)) ni$spy<-spy ni$spx<-spx uu<-summary(glmmadmb(spy~sex+poswing+spx+(1|host),data=ni, family="nbinom",zeroInflation=True)) and that works. however, when I call glmmadmb interactively, it accepts in the formula variables which are in the dataframe specified by the 'data' argument, as well as variables which are not. and if in my function I replace glmmadmb by glm it works even if spy and spx are not in the 'ni' dataframe. that puzzles me. ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.