[R] Error in mkRespMod(fr, family = family) : response must be numeric

William Dunlap wdunlap at tibco.com
Tue Nov 17 01:10:52 CET 2015


You should look at the data that you imported to R from somewhere else
with the str() or summary() function.  Since you think the data should
have nice column names but seems to have the names V1, ..., Vn, I
think that you may may have read a file with column names at the top
into R with read.table without specifying header=TRUE.  With
header=FALSE, the names will cause read.table to think that the column
contains character data and header=FALSE also causes the column names
to be V1, ..., Vn.

 E.g.,

> dataText <- "ColA ColB\n1 100\n2 200\n"
> str(read.table(text=dataText))
'data.frame':   3 obs. of  2 variables:
 $ V1: Factor w/ 3 levels "1","2","ColA": 3 1 2
 $ V2: Factor w/ 3 levels "100","200","ColB": 3 1 2
> str(read.table(text=dataText, header=TRUE))
'data.frame':   2 obs. of  2 variables:
 $ ColA: int  1 2
 $ ColB: int  100 200

Again, use str() and summary() (or some of Hadley's tools) to make
sure what you read into R is what you think it is.  Also, make some
simple plots of the data, say with pairs().  Do this before fitting
any serious models to it.
Bill Dunlap
TIBCO Software
wdunlap tibco.com


On Sun, Nov 15, 2015 at 1:58 PM, Tania Pollak <pollaktn at gmail.com> wrote:
> Hi --
>
> I am new to R, and not much more advanced in stats, but am trying to learn
> my way through the program to finish my master's thesis.  I am trying to
> run tests using glmer, and am getting the above error message.
>
> My code is:
>
>> test1=glmer(V12~V10+(1|V4),family=poisson)
> Error in mkRespMod(fr, family = family) : response must be numeric
>
> (The V's are the column numbers for the variable names -- the program
> doesn't seem to recognize the actual variable names, although they are in
> the table, but does recognize the column numbers.)
>
> Any help is much appreciated.  I tried searching online for some guidance,
> but came up empty.
>
> Thank you --
>
> Tania
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list