Skip to content

Error message glmer using R: “ 'what' must be a character string or a function”

6 messages · David Winsemius, EmmaB, William Dunlap +1 more

#
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)

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.

Many thanks

Emma




--
View this message in context: http://r.789695.n4.nabble.com/Error-message-glmer-using-R-what-must-be-a-character-string-or-a-function-tp4679829.html
Sent from the R help mailing list archive at Nabble.com.
#
On Nov 5, 2013, at 3:36 PM, EmmaB wrote:

            
You at least need to post the output of str(new).
David Winsemius
Alameda, CA, USA
#
'data.frame':   1214 obs. of  4 variables:
 $ ?..VAR00001 : logi  NA NA NA NA NA NA ...
 $ random      : int  1 1 1 1 1 1 1 1 1 1 ...
 $ clustno     : int  1 1 1 1 1 1 1 1 1 1 ...
 $ validatedRS6: int  0 0 0 0 0 0 0 0 0 0 ...



--
View this message in context: http://r.789695.n4.nabble.com/Error-message-glmer-using-R-what-must-be-a-character-string-or-a-function-tp4679829p4679836.html
Sent from the R help mailing list archive at Nabble.com.
#
You can reproduce the problem by having a data.frame (or anything else) in your
environment:

new <- data.frame(?..VAR00001 = rep(c(TRUE,NA,FALSE), c(10,2,8)), random=rep(1:3,len=20), clustno=rep(c(1:5),len=20), validatedRS6=rep(0:1,len=20))
model1<- glmer(validatedRS6 ~ random + (1|clustno), data=new, family=binomial(), nAGQ=3)
# Error in do.call(new, c(list(Class = "glmResp", family = family), ll[setdiff(names(ll),  : 
#  'what' must be a character string or a function

The problem is in the call
   do.call(new, list())
It finds your dataset 'new' (in .GlobalEnv), which is not a function or the name of a function,
not the function 'new' from the 'methods' package.  Rename your dataset, so you do not
have anything called 'new' masking the one in package:methods, and things should work.

Write to the maintainer of the package (use maintainer("lme4") for the address) about the
problem.

Bill Dunlap
Spotfire, TIBCO Software
wdunlap tibco.com
#
I left out "called 'new'" in the above statement.  The example is correct.

Bill Dunlap
Spotfire, TIBCO Software
wdunlap tibco.com
#
William Dunlap <wdunlap <at> tibco.com> writes:
[snip]
For what it's worth, I saw this on StackOverflow:

[broken URL]
http://stackoverflow.com/questions/19801070/
  error-message-glmer-using-r-what-must-be-a-character-string-or-a-function

answered it there, and have fixed it on Github: 

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

While it is not officially forbidden in 
http://www.r-project.org/posting-guide.html (to my surprise, I can't
even find any proscription against cross-posting to R mailing lists,
although there is a section about "which list to post to"), posting
to both r-help and Stack Overflow tends to lead to duplicated effort/
frustration.  Please choose one or the other (in my opinion it's
OK to cross-post after a few days if you don't get any responses
in one place, provided that you say that you've cross-posted and
ideally provide a reference link to the cross-post).

  Ben Bolker