[R] Error in variable ' _' converted to a factor AND *tmp*

Milan Bouchet-Valat
2012-01-18T10:50:40Z

Le mardi 17 janvier 2012 ? 23:56 -0800, Jhope a ?crit :
> I am wondering if anyone can tell me what the error I'm receiving means
> below. I thought it said that Aeventexhumed should be converted to a
factor,
> so I tried to do so and received the following error.
>
> Please advise. J
> ---------------------------------------------------------
>
> > data.to.analyze.glm <- glm(cbind(MaxHatch, TotalEggs-MaxHatch) ~
> > Aeventexhumed, family=binomial, data=data.to.analyze)
> Warning message:
> In model.matrix.default(mt, mf, contrasts) :
>   variable 'Aeventexhumed' converted to a factor
>
> > data.to.analyze$Aevent ~ as.factor(data.to.analyze$Aevent)
> data.to.analyze$Aevent ~ as.factor(data.to.analyze$Aevent)
What is this supposed to do? You're just creating a formula and printing
it here.

> > data.to.analyze$Aeventexhumed <- as.factor(data.to.analyze$Aevent)
> Error in `$<-.data.frame`(`*tmp*`, "Aeventexhumed", value =
integer(0)) :
>   replacement has 0 rows, data has 127
This simply means that data.to.analyze$Aeventexhumed is of length 127,
while data.to.analyze$Aevent is of length 0 (or most probably doesn't
exist).

I think you meant to do:
data.to.analyze$Aeventexhumed <- factor(data.to.analyze$Aeventexhumed)


Regards