Installation instructions for R packages

To install R for the first time, or to replace an outdated version of R, download the appropriate version of R from its website.

If you are working on a Mac we would also recommend installing Rstudio, which can be downloaded from its website here.

Make sure that you have the most recent version of R. You can check your R version by typing the command R.version into an R command prompt. The current version of R is:

R.version
##                _                           
## platform       x86_64-w64-mingw32          
## arch           x86_64                      
## os             mingw32                     
## system         x86_64, mingw32             
## status                                     
## major          3                           
## minor          5.0                         
## year           2018                        
## month          04                          
## day            23                          
## svn rev        74626                       
## language       R                           
## version.string R version 3.5.0 (2018-04-23)
## nickname       Joy in Playing

To install packages, open a new session of R. No other sessions of R should be currently running.

Next, copy & paste the following commands to your R command prompt:

install.packages("ape",repos="https://cloud.r-project.org",quiet=TRUE)
install.packages("caper",repos="https://cloud.r-project.org",quiet=TRUE)
install.packages("diversitree",repos="https://cloud.r-project.org",quiet=TRUE)
install.packages("geiger",repos="https://cloud.r-project.org",quiet=TRUE)
install.packages("nlme",repos="https://cloud.r-project.org",quiet=TRUE)
install.packages("OUwie",repos="https://cloud.r-project.org",quiet=TRUE)
install.packages("phangorn",repos="https://cloud.r-project.org",quiet=TRUE)
install.packages("phytools",repos="https://cloud.r-project.org",quiet=TRUE)

The result should looks something like this:

install.packages("ape",repos="https://cloud.r-project.org",quiet=TRUE)
## package 'ape' successfully unpacked and MD5 sums checked
install.packages("caper",repos="https://cloud.r-project.org",quiet=TRUE)
## package 'caper' successfully unpacked and MD5 sums checked
install.packages("diversitree",repos="https://cloud.r-project.org",quiet=TRUE)
## package 'diversitree' successfully unpacked and MD5 sums checked
install.packages("geiger",repos="https://cloud.r-project.org",quiet=TRUE)
## package 'geiger' successfully unpacked and MD5 sums checked
install.packages("nlme",repos="https://cloud.r-project.org",quiet=TRUE)
## package 'nlme' successfully unpacked and MD5 sums checked
install.packages("OUwie",repos="https://cloud.r-project.org",quiet=TRUE)
## package 'OUwie' successfully unpacked and MD5 sums checked
install.packages("phangorn",repos="https://cloud.r-project.org",quiet=TRUE)
## package 'phangorn' successfully unpacked and MD5 sums checked
install.packages("phytools",repos="https://cloud.r-project.org",quiet=TRUE)
## package 'phytools' successfully unpacked and MD5 sums checked

You can check package versions as follows:

packageVersion("ape")
## [1] '5.1'
packageVersion("caper")
## [1] '1.0.1'
packageVersion("diversitree")
## [1] '0.9.10'
packageVersion("geiger")
## [1] '2.0.6'
packageVersion("nlme")
## [1] '3.1.137'
packageVersion("OUwie")
## [1] '1.50'
packageVersion("phangorn")
## [1] '2.4.0'
packageVersion("phytools")
## [1] '0.6.44'

Your package versions should match (or be more recent - that is, have higher values) than the package versions listed above.

Since we will use the package phytools a lot in this course, after running the steps above, we also strongly recommend updating phytools from GitHub.

This can be done as follows:

install.packages("devtools",repos="https://cloud.r-project.org",quiet=TRUE)
library(devtools)
install_github("liamrevell/phytools")

This ensures that you have the latest phytools version if it is more recent than the version on CRAN.

As of the current date, your version of phytools installed this way should be as follows:

packageVersion("phytools")
## [1] '0.6.59'

Written by Liam J. Revell. Last updated 24 June 2018.