## random ultrametric tree
## -----------------------
#set.seed(12)
#phy <- rcoal(20, tip.label = paste("whale", LETTERS[1:20]))
#phy$tip.label[6:9] <- gsub("whale", "humpback", phy$tip.label[6:9])
#phy$tip.label[12] <- gsub("whale", "humpback", phy$tip.label[12])
#phy <- fixNodes(ladderize(phy))
#plot(phy, no.margin = TRUE); nodelabels(cex = .5)
## default use adding four species
## -------------------------------
#spec <- c("Athelia V",
# paste("Cladonia", c("X", "Y", "Z")))
#phy.crown <- phy
#for (i in seq_along(spec))
# phy.crown <- addTip(phy.crown, spec[i])
#plot(phy.crown, no.margin = TRUE); nodelabels(cex = .5)
## random addition of tips to their genus
## ---------------------------------------
#spec <- paste("Cladonia", c("X", "Y", "Z"))
#phy.random <- phy
#for (i in seq_along(spec))
# phy.random <- addTip(phy.random, spec[i], insert = "randomly")
#plot(phy.random, no.margin = TRUE); nodelabels(cex = .5)
Run the code above in your browser using DataLab