[R-sig-ME] error in lmer: length(f1) == length(f2) is not TRUE

Ben Bolker bbolker at gmail.com
Wed Oct 17 00:16:23 CEST 2012


joana martelo <jmmartelo at ...> writes:

> 
> Dear list
> 
  
 [snip]

> 
> I’m using lme4 and tried:
> model<-lmer(reactive.dist~velocity+density+(1|trial/fish.id),family=gaussian
> )
> but got this error and warning:
> 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
> Is this because I don’t have the same number of reactive distances per fish?

> When I do:
> 
> model<-lmer(reactive.dist~velocity+density(1|fish.id),family=gaussian)
> 
> it works fine

.

  If you search for this error at http://glmm.wikidot.com/faq
I think you'll get the hint that you're using a numeric variable
as a grouping factor -- in this case I believe trial is numeric
and should be converted to a factor.

  Ben Bolker



More information about the R-sig-mixed-models mailing list