[R-sig-ME] error in lmer: length(f1) == length(f2) is not TRUE
joana martelo
jmmartelo at fc.ul.pt
Wed Oct 17 20:26:37 CEST 2012
I've changed the code of my factor levels to trial: A,B,C...... and fish.id:
A1,A2....B1,B2....., and used data=.... and it worked!
Thank you so much Ben!
Joana
-----Mensagem original-----
De: r-sig-mixed-models-bounces at r-project.org
[mailto:r-sig-mixed-models-bounces at r-project.org] Em nome de Ben Bolker
Enviada: quarta-feira, 17 de Outubro de 2012 19:03
Para: r-sig-mixed-models at r-project.org
Assunto: Re: [R-sig-ME] error in lmer: length(f1) == length(f2) is not TRUE
joana martelo <jmmartelo at ...> writes:
>
> Thanks for your answers, but it still doesn't work.
> Trial and fish.id are factors, but I get the same error:
>
> > Error: length(f1) == length(f2) is not TRUE In addition: Warning
> > messages:
> > 1: In fish.id:trial :
> > numerical expression has 2518 elements: only the first used
> > 2: In fish.id:trial :
> > numerical expression has 2518 elements: only the first used
>
> I've tried to find the answer in other mailing lists, but they all
> give the
same answer....
>
> Any ideas of what the mistake might be?
>
Not sure, but I strongly recommend that you put your response variable
along with all of your predictor variables into a data frame together and
use the data= argument to glmer(). It's extremely easy to have a modified
version of one of the predictors floating around in the workspace. It's
also possible (although I think this would technically constitute a bug in
lmer ...) that this is caused by NAs somewhere in the dataset, although I
couldn't provoke it with this
sample:
d <- data.frame(y=rnorm(200),f1=sample(LETTERS[1:5],200,replace=TRUE),
f2=sample(letters[1:5],200,replace=TRUE))
d$f2[100] <- NA
lmer(y~1+(1|f1/f2),data=d)
If putting your variables into a data frame and using na.omit() on it
don't make the problem go away, then we'll need a reproducible example to
get any farther ...
_______________________________________________
R-sig-mixed-models at r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
-----
Não foram detectados vírus nesta mensagem.
Verificado por AVG - www.avg.com
Versão: 2012.0.2221 / Base de dados de Vírus: 2441/5336 - Data de
Lançamento: 10/16/12
More information about the R-sig-mixed-models
mailing list