Error message in lme4::glmer: “ 'what' must be a character string or a function”

寵の児 提交于 2019-11-28 04:10:01

问题


I am running a multi-level model. I use the following commands with validatedRS6 as the outcome, random as the predictor and clustno as the random effects variable.

new<-as.data.frame(read.delim("BABEX.dat", header=TRUE))
install.packages("lme4")
library(lme4)
model1<- glmer(validatedRS6 ~ random + (1|clustno), data=new, family=binomial("logit"), nAGQ = 1L)

However, I get the following error

Error in do.call(new, c(list(Class = "glmResp", family = family), ll[setdiff(names(ll), : 'what' must be a character string or a function

I have absolutely no idea what has gone wrong and have searched the internet. I am sorry but I cannot provide the data as it is from an intervention which has yet to be published.


回答1:


(expanded from comment).

Congratulations, you found a bug in lme4! This is fixed now:

https://github.com/lme4/lme4/commit/9c12f002821f9567d5454e2ce3b78076dabffb54

It is caused by having a variable called new in the global environment (deep in the guts of the code, lme4 uses do.call(new,...) and finds your variable new rather than the built-in function new).

You can install a patched version from Github using devtools::install_github() (but you'll need compilation tools etc.). Alternately, there is a very simple workaround -- just call your variable anything other than new (you can't just copy it, i.e. new2 <- new -- you also have to make sure the old version is removed (rm("new"))).



来源:https://stackoverflow.com/questions/19801070/error-message-in-lme4glmer-what-must-be-a-character-string-or-a-function

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!