I find the within function to be helpful in these cases

bt.data <- within(bt.data, {speaker <- factor(speaker); sentence <-
factor(sentence); tempo <- factor(tempo)})


On Wed, May 15, 2013 at 2:13 PM, Jake Westfall <jake987722@hotmail.com>wrote:

> You converted those variables to factors, but then saved those factors in
> the workspace. The variables in the dataset are still numerics. And then
> when you fit the model, you accessed the numeric variables from the
> dataset, not the factor variables in the workspace. You should replace
> those 3 lines with the following:
>
> bt.data$speaker <- factor(bt.data$speaker)
> bt.data$sentence <- factor(bt.data$sentence)
> bt.data$tempo <- factor(bt.data$tempo)
> Jake
> > Date: Wed, 15 May 2013 10:16:26 +0200
> > From: volker.dellwo@uzh.ch
> > To: r-sig-mixed-models@r-project.org; jake987722@hotmail.com
> > Subject: Re: R-sig-mixed-models Digest, Vol 77, Issue 11
> >
> > Hi Jake,
> >
> > thanks a million for your answer!
> >
> > > It's hard to make any definite diagnoses without seeing
> > > the output of the commands you listed, but my suspicion is that you
> > > have your "speaker" and "sentence" factors represented in your data
> > > frame as numeric objects (e.g., integers 1 to length(speaker))
> > > instead of factor objects. So when you try to test speaker or
> > > sentence by putting them in the model as fixed effects, the model
> > > tries to fit a non-sensical slope to the arbitrary x-values given by
> > > the factor labels.
> >  > Obviously this kind of test doesn't make sense.
> >
> > Yes, I totally agree. But then I did this:
> >       speaker <- factor(bt.data$speaker);
> >       sentence <- factor(bt.data$sentence);
> >       tempo <- factor(bt.data$tempo);
> >  From what I read it seems to me that the three variables should then be
> > treated as factor objects; am I right or wrong here?
> >
> > With is.factor(speaker), for example, I receive the response "TRUE"
> >
> > Best wishes,
> > Volker
>
>         [[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-mixed-models@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
>

	[[alternative HTML version deleted]]

