2 Ahead of the workshop
Here are a few things you should know and you should do ahead of the workshop.
2.1 Install R and the required packages
To perform the examples of this document, you will need to have the R software installed on your computer. I strongly recommend that you install RStudio. Although R Studio is not required, it facilitates interactions between scripts and the R console and provides many great tools.
After installing R, you will have to install some packages. For this specific tutorial, we will need to load the following R packages.
To execute the code of this tutorial in R, I suggest that you create a new script (File>New File>R Script) where you paste the code copied from the boxes. In R Studio, you can then run this code by selecting the lines you want to execute and then press run (or associated shortcut). This will replicate the analyses presented in the tutorial. You should save the script file in a directory dedicated for the workshop where you will also place the data files required (see section 2.2). Then, you should make sure that you script (and data) are in the R working directory. In R Studio, this can be set form the menu: ‘Session > Set Working Directory’.
If some of the packages above are not yet installed on your computer, you get error messages when trying to load them. If this is the case, you will have to install them using the function install.packages(). You only have to install them only once.
install.packages('nlme')
install.packages('ape')
install.packages('RColorBrewer')
install.packages('ggplot2')Once the packages are installed, you can load the packages using the library() function. Also note that if you are using both the packages nlme and ape, nlme should be loaded first. If you don’t do this, you might get errors; you could then restart R and start over.
2.2 Downloading the data
The data you will need for this tutorial can be downloaded from this repository: data.zip.
I suggest that you download the folder, uncompress it, and place is in a dedicated folder where you will also save the script with all the commands you will use.
2.3 Get acquainted with phylogenetic trees in R
I you never used phylogenetic trees in R, you can learn some basic techniques on how to handle them and simulate trees and characters by reading chapter 14.