Reading in the data files

First we read in the data files.

sqTree<-read.tree(text=getURL("https://raw.githubusercontent.com/lukejharmon/pcm/master/datafiles/squamate.phy"))
plot(sqTree)

sqData<-read.csv(text=getURL("https://raw.githubusercontent.com/lukejharmon/pcm/master/datafiles/brandley_table.csv"))

Simulate binary character on tree

This code generates plots like Figure 7.4

qMatrix<-cbind(c(-1, 1), c(1, -1))*0.001
sh_slow<-sim.history(sqTree, qMatrix, anc="1")
## Done simulation(s).
plotSimmap(sh_slow, pts=F, ftype="off")
## no colors provided. using the following legend:
##       1       2 
## "black"   "red"
add.simmap.legend(leg=c("limbed", "limbless"), colors=c("black", "red"), x=0.024, y =23, prompt=F)