In this practical you will learn how to run one-way ANOVA and Kruskal-Wallis in R, interpret their output and report the results. You will also practice choosing between them.

Learning Outcomes

By actively following the lecture and practical and carrying out the independent study the successful student will be able to:

  • Explain the rationale behind ANOVA and complete a partially filled ANOVA table (MLO 1 and 2)
  • Apply (appropriately), interpret and evaluate the legitimacy of, one-way ANOVA and Kruskal-Wallis including post-hoc tests in R (MLO 2, 3 and 4)
  • Summarise and illustrate with appropriate R figures test results scientifically (MLO 3 and 4)


Workshops are not a test. It is expected that you often don’t know how to start, make a lot of mistakes and need help. Do not be put off and don’t let what you can not do interfere with what you can do. You will benefit from collaborating with others and/or discussing your results.

The lectures and the workshops are closely integrated and it is expected that you are familar with the lecture content before the workshop. You need not understand every detail as the workshop should build and consolidate your understanding. You may wish to refer to the slides as you work through the workshop schedule.


One-way ANOVA and Kruskal-Wallis: pdf (recommended) / pptx


Getting started

W Start RStudio from the Start menu.

R In RStudio, set your working directory to the folder you created previously for your 17C Data Analysis work.

R Make a new script file called workshop6.R to carry out the rest of the work.

R You probably want to load the tidyverse with library(tidyverse).

Myoglobin in seal muscle

The myoglobin concentration of skeletal muscle of three species of seal in grams per kilogram of muscle was determined and the data are given in seal.txt. We want to know if there is a difference between species. Each row represents an individual seal. The first column gives the myoglobin concentration and the second column indicates species.


R Save a copy to your working directory, read it in and check the structure. Do you need to check back to Week 3: Testing, Data types and Reading in data

R Do a quick plot of the data. Do you need to check back to Week 7: One- and two-sample tests