[R] Error: length(f1) == length(f2) is not TRUE

William Dunlap wdunlap at tibco.com
Fri Sep 18 17:34:51 CEST 2009


> From: r-help-bounces at r-project.org 
> [mailto:r-help-bounces at r-project.org] On Behalf Of A Singh
> Sent: Friday, September 18, 2009 4:42 AM
> To: r-help at r-project.org
> Subject: [R] Error: length(f1) == length(f2) is not TRUE
> 
> 
> Dear R users,
> 
> I am trying to fit an lmer model with only random effects 
> which is giving 
> me the following error:
> 
> Error : length(f1) == length(f2) is not TRUE
> In addition: Warning messages:
> 1: In P1L55:family :
>   numerical expression has 390 elements: only the first used
> 2: In P1L55:family :
>   numerical expression has 390 elements: only the first used
> 
> 
> I am trying to extract variance components for a phenotype 
> 'peg.no', using 
> the variable 'family' and a marker column 'P1L55' (which is 
> categorical and 
> has 2 levels- 0 and 1), as random effects. There are no fixed effects.
> 
> The code I used is as follows:
> 
> vc<-read.table(...)
> 
> vcdf<-data.frame(vc)
> colms<-(vc)[4:13] ##these are the markers
> lapply(colms,factor)

Note that you did not change columns 4:13 of vcdf to factors:
you changed copies of them to factors.  Do
   vcdf[4:13] <- lapply(vcdf[4:13], factor)
and lmer should be happier.

Bill Dunlap
TIBCO Software Inc - Spotfire Division
wdunlap tibco.com  

> 
> try(fit<-lmer(peg.no~1 + (1|family/P1L55), 
> na.action=na.include, data=vcdf))
> 
> 
> I thought that putting the data into a dataframe would help, 
> along with the 
> na.exclude command, because there is a lot of missing data in 
> patches which 
> I have replaced with NA's, but I  don't know how to fix this 
> error at all.
> 
> Its a bit urgent, and any help is hugely appreciated.
> 
> The data files are at:
> 
> 
> <http://www.4shared.com/file/131980362/460bdafe/Testvcomp10.ht
> ml> (excel)
> http://www.4shared.com/file/131980512/dc7308b/Testvcomp10.html
> (txt)
> 
> 
> Cheers,
> Aditi
> 
> ----------------------
> A Singh
> Aditi.Singh at bristol.ac.uk
> School of Biological Sciences
> University of Bristol
> 
> ______________________________________________
> R-help at r-project.org mailing list
> 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