[R] Error Message During ANOVA

Pascal Oettli kridox at ymail.com
Thu Feb 14 01:23:44 CET 2013


Hello,

The first error message says:

 > Error in model.frame.default(formula = r ~ tm, drop.unused.levels = 
TRUE) : variable lengths differ (found for 'tm')

Please compare the size of 'r' and 'tm'.

Regards,
Pascal

Le 14/02/2013 07:14, Craig O'Connell a écrit :
> Dear R-Help,
>
> I'm using an ANOVA to determine if there is any variation that exists
> between my four different shark-types and their entrance behavior towards
> an apparatus.
>
> To do this, my coding was:
>
> df1=read.table("lemonentrance.txt", header=TRUE); df1
>
> c(t(as.matrix(df1)))
>
> r = c(t(as.matrix(df1))) # response data
>
> r
>
> f=c("Con","Bro","OEy","Bli")
>
> k=4
>
> n=6
>
> tm=gl(k,1,n*k,factor(f))
>
> tm
>
> av=aov(r~tm)
>
> Error in model.frame.default(formula = r ~ tm, drop.unused.levels = TRUE) :
>    variable lengths differ (found for 'tm')
>
> summary(av)
>
> Error in summary(av) : object 'av' not found
>
> As you can see, I receive two error message, with teh second being a cause
> of the first.  Does anybody have any idea how I can fix this, or at least
> would you happen to know what the error is referring to?
>
> Thanks and a response would be greatly appreciated.
>
> Kind Regards,
>
> Craig
>
>
>



More information about the R-help mailing list