I\'m trying to write a function that collects some calls I use often in scripts
I use the sleepstudy data of the lme4 package in my examples
Here\'s (a simplified
Do it like this:
trimModel1 <- function(frm, df) {
require(LMERConvenienceFunctions)
require(lme4)
dfname <- as.name(deparse(substitute(df)))
lm<-lmer(frm,data=df)
lm.trimmed = romr.fnc(lm, df)
df = lm.trimmed$data
# update initial model on trimmed data
lm<-lmer(frm,data=df)
lm@call$formula <- frm
lm@call$data <- dfname
mcp.fnc(lm)
lm
}
It's the "deparse-substitute trick" to get an object name from the object itself.