I have a dataset where the samples are grouped by column. The following sample dataset is similar to my data format:
a = c(1,3,4,6,8) b = c(3,6,8,3,6) c = c(2,1,4,3,6) d = c(2,2,3,3,4) mydata = data.frame(cbind(a,b,c,d))
When I execute one ANOVA factor in Excel using the above dataset, I get the following results:

I know that a typical format in R is as follows:
group measurement a 1 a 3 a 4 . . . . . . d 4
And the command to execute ANOVA in R will use aov(group~measurement, data = mydata) . How to execute a single ANOVA factor in R with patterns sorted by column rather than row? In other words, how do I duplicate Excel results using R? Many thanks for the help.
source share