For this exercise we will fit models of discrete character evolution. We can use a dataset from a paper by Brandley et al. (2008 Evolution 62:2042)
First, load the data files into R. You can download the files here:
library(ape)
library(phytools)
## Loading required package: maps
##
## # maps v3.1: updated 'world': all lakes moved to separate new #
## # 'lakes' database. Type '?world' or 'news(package="maps")'. #
sqData<-read.csv("brandley_table.csv")
sqTree<-read.nexus("squamate.tre")
plotTree(sqTree,type="fan",lwd=1,fsize=0.5)