Hello all.  Why doesn't this work?

d=data.frame(y=rpois(10,1),x=rnorm(10),z=rnorm(10),grp=rep(c('a','b'),each=5))
library(lme4)
model=lmer(y~x+z+(1|grp),family=poisson,data=d)
update(model,~.-z)###works, removes z
var='z'
update(model,~.-get(var))##doesn't remove z
update(model,~. -get(var,pos=d))###doesn't remove z

I am trying to remove z from the model in the update, but I can't do it
using get(), which is what I would like to do for a more complicated
program.  There's something about environments and get() that I don't
understand.

Any suggestions?

Thanks.

        [[alternative HTML version deleted]]

______________________________________________
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.

Reply via email to