One way ANOVA in R
The one way analysis of variance is used to test if three or more means are equal. One way ANOVA is an extension of two independent samples t-test.
- Open the R console
- Change the working directory to the directory where your file is"
- Read the file: E.g the file used here is smaple.csv. The file has three groups with the following format
|Header 1||Header 2||Header 3|
- Read the file and name it (e.g metab)
metab <- read.csv ("sample.csv, header= T)
- confirm the file is imported. When you call for metab and press enter you should see the table
- make box plot
- Then use the following command to conduct one way anova and Tukey's test
smetab <- stack(metab)
names(smetab) <- c("length", "group")
av1<-aov(length ~ group, data=smetab)