#let's create a small, really cheesy example
pokexample<-rbind(cbind("Squirtadae",c("Squirtle","Blastoise","Wartortle")),
c("Shelloidea","Lapras"),c("Shelloidea","Squirtadae"),
c("Pokezooa","Shelloidea"),c("Pokezooa","Parasect"),
c("Rodentapokemorpha","Linoone"),c("Rodentapokemorpha","Sandshrew"),
c("Rodentapokemorpha","Pikachu"),c("Hirsutamona","Ursaring"),
c("Hirsutamona","Rodentapokemorpha"),c("Pokezooa","Hirsutamona"))
#Default: tipSet='nonParents'
pokeTree<-parentChild2taxonTree(pokexample, tipSet="nonParents")
plot(pokeTree);nodelabels(pokeTree$node.label)
#Get ALL taxa as tips with tipSet='all'
pokeTree<-parentChild2taxonTree(pokexample, tipSet="all")
plot(pokeTree);nodelabels(pokeTree$node.label)
# let's try a dataset where not all the taxon relationships lead to a common root
pokexample_bad<-rbind(cbind("Squirtadae",c("Squirtle","Blastoise","Wartortle")),
c("Shelloidea","Lapras"),c("Shelloidea","Squirtadae"),
c("Pokezooa","Shelloidea"),c("Pokezooa","Parasect"),
c("Rodentapokemorpha","Linoone"),c("Rodentapokemorpha","Sandshrew"),
c("Rodentapokemorpha","Pikachu"),c("Hirsutamona","Ursaring"),
c("Hirsutamona","Rodentapokemorpha"),c("Pokezooa","Hirsutamona"),
c("Umbrarcheota","Gengar"))
#this should return an error, as Gengar doesn't share common root
pokeTree<-parentChild2taxonTree(pokexample_bad)Run the code above in your browser using DataLab