lme4 :: glmer中的错误消息: “什么"必须是字符串或函数“ [英] Error message in lme4::glmer: " 'what' must be a character string or a function"

查看:207
本文介绍了lme4 :: glmer中的错误消息: “什么"必须是字符串或函数“的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在运行一个多级模型.我使用以下命令,以validatedRS6作为结果,以random作为预测变量,并使用clustno作为随机效应变量.

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)

但是,出现以下错误

do.call(new,c(list(Class ="glmResp",family = family),ll [setdiff(names(ll),: 'what'必须是字符串或函数

我绝对不知道出了什么问题,已经在互联网上搜索了.很抱歉,但是我无法提供数据,因为它来自尚未发布的干预措施.

解决方案

(从注释扩展).

恭喜,您在lme4中发现了一个错误!现在已解决:

https://github.com/lme4/lme4/commit/9c12f002821f9567d5454e2ce3b78076dabff /p>

这是由于在全局环境中有一个名为new的变量引起的(深入代码内,lme4使用do.call(new,...)并找到了变量new而不是内置函数).

您可以使用devtools::install_github()从Github安装补丁版本(但需要编译工具等).或者,有一个非常简单的解决方法-只需将变量调用new以外的任何其他名称即可(您不能仅复制它,即new2 <- new,还必须确保已删除旧版本(rm("new") )).

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.

解决方案

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

这篇关于lme4 :: glmer中的错误消息: “什么"必须是字符串或函数“的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆