Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
775 views
in Technique[技术] by (71.8m points)

r - Error message in lme4::glmer: " 'what' must be a character string or a function"

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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

(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"))).


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...