[R] anova test for variables with different lengths

Sachinthaka Abeywardana sachin.abeywardana at gmail.com
Tue Oct 16 05:18:01 CEST 2012


Hi all,

I want to test whether the MEAN of two different variables, (and
different number of observations) are the same. I am trying to use the
anova test but it doesn't seem to like that the number of observations
are different:

a=c(1:5)
b=c(1:3)
aov_test=aov(a~b)
>>Error in model.frame.default(formula = a ~ b, drop.unused.levels = TRUE) :
  variable lengths differ (found for 'b')

Any ideas as to how I would go about doing this test?

Thanks,
Sachin



More information about the R-help mailing list