Question

I have to make ANOVA in R using build-in packages, my data seems like this :

dane=cbind(a=rnorm(10),b=rnorm(10),c=c(1,1,1,1,2,2,2,2,2,2))

a and b are variables for which I want to test hypothesis about equality of means in groups assigned by c variable. My case is the simplest case when t-test is not enough.

Was it helpful?

Solution

dane <- data.frame(dane)
with(dane, aov(c(a[c==1],b[c==2]) ~ c))

Or, if you mean to test both a and b as separate dvs:

with(dane, aov(a ~ c))
with(dane, aov(b ~ c))
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top