This web page and its sub-pages shows R commands to analyze the data for all examples presented in the 2 nd edition of The Analysis of Biological Data by Michael Whitlock and Dolph Schluter. Although intended as a learning aid (we learned R ourselves by copying what other people did), it is not basic instructional material. Some prior knowledge of R would be helpful. On the sidebar we provide a link to a short workshop to help get you started.
The command pages use basic R as much as possible, but we make use of a few add-on packages to get specific analyses done more simply:
binom for Agresti-Coull confidence intervals for proportions (Chapter 7).
epitools for odds ratio and relative risk (Chapter 9).
car for Levene’s test (Chapter 12) and for fitting multiple explanatory variables (Chapter 18).
multcomp for planned and unplanned comparisons between means (Chapter 15).
Use the following commands in R to install them, as needed.
install.packages("binom", dependencies = TRUE) install.packages("epitools", dependencies = TRUE) install.packages("car", dependencies = TRUE) install.packages("multcomp", dependencies = TRUE)
R is a free, open-source software package for statistical analysis on Mac, PC, and other computer platforms. It is becoming the standard program for analyzing data in the biological sciences. Many instructors that use The Analysis of Biological Data also teach R as a component of their courses. Nearly every statistical technique ever invented is available in R, and new methods are made available for free every day. The ability to use R is a useful skill in biology and medicine.
R can be downloaded (for free) from http://cran.rstudio.com. Follow the instructions there corresponding to your computer operating system.
We also recommend that you download the free add-on program called RStudio. RStudio creates a nice desktop environment in which to run R. It is not required but might help get you started in R. RStudio can be downloaded from https://www.rstudio.com/ide/download/.
The first link on the sidebar takes you to a short series of exercises to get you using the command line in R. More extensive online introductions can be found elsewhere (http://www.introductoryr.co.uk/R_Resources_for_Beginners.html).
If you see any errors on these pages, please send an email to the authors at this address. Thanks in advance for your help.
There is a Github project from Frank Harrell at https://github.com/harrelfe/rscripts with R Markdown scripts that define data and set up the analysis for several practice and assignment problems in the text. Scripts may be automatically downloaded and sent to the RStudio script editor window using the R Hmisc package’s getRs function. getRs can also list all available scripts, major and minor categories of scripts, and find scripts by phrases contained in their categories. Scripts related to the text are named abdc-p.Rmd where c is the chapter number and p is the problem number.