[R-sig-ME] Using as.formula with glmmADMB

Alison Fairbrass alison.fairbrass.10 at ucl.ac.uk
Tue Nov 1 10:14:58 CET 2016

Dear all,

I am using as.formula to create a number of models with the same main
effects and different interaction terms using the following code:

mainEffects <- "poly(LC1,2) + poly(LC2,2) + poly(LC3,2) + poly(LC4,2) +
poly(LC5,2) +"

interactionTerms <- c("poly(LC1,2):poly(LC2,2)", "poly(LC1,2):poly(LC3,2)",
"poly(LC1,2):poly(LC4,2)", "poly(LC1,2):poly(LC5,2)")


for (interactionTerm in interactionTerms){

  newformula <- as.formula(paste('SPR ~', mainEffects, interactionTerm,'+


  assign(paste("M", loop, sep=""), glmer(newformula, family=poisson, data =


This works fine when fitting models using glmer. However, when assigning
the model using glmmADMB (e.g. assign(paste("M", loop, sep=""),
glmmadmb(newformula, zeroInflation=TRUE, family="nbinom", data=dat)) I
receive the following error message:

Error in f[2] : object of type 'symbol' is not subsettable

Does glmmADMB not work with as.formula?

I am using glmmADMB v.0.7 with R v.3.1.2.

Many thanks in advance for your assistance,



Alison Fairbrass
Engineering Doctorate
University College London
Civil, Environmental and Geomatic Engineering

Twitter: @AlisonFairbrass

Webpage: https://www.ucl.ac.uk/cber/people/alison-fairbrass

alison.fairbrass.10 at ucl.ac.uk
alison.fairbrass at gmail.com

	[[alternative HTML version deleted]]

More information about the R-sig-mixed-models mailing list