# NOT RUN {
set.seed(1)
# }
# NOT RUN {
#get some example occurrence and taxonomic data
data(graptPBDB)
#get the taxon tree: Linnean method
graptTreeLinnean <- makePBDBtaxonTree(
taxaDataPBDB = graptTaxaPBDB,
rankTaxon = "genus",
method = "Linnean")
#get the taxon tree: parentChild method
graptTreeParentChild <- makePBDBtaxonTree(
taxaDataPBDB = graptTaxaPBDB,
rankTaxon = "genus",
method = "parentChild")
# let's plot these and compare them!
plotTaxaTreePBDB(graptTreeParentChild)
plotTaxaTreePBDB(graptTreeLinnean)
# pause 3 seconds so we don't spam the API
Sys.sleep(3)
####################################################
# let's try some other groups
###################################
#conodonts
conoData <- getCladeTaxaPBDB("Conodonta")
conoTree <- makePBDBtaxonTree(
taxaDataPBDB = conoData,
rankTaxon = "genus",
method = "parentChild")
# plot it!
plotTaxaTreePBDB(conoTree)
# pause 3 seconds so we don't spam the API
Sys.sleep(3)
#############################
#asaphid trilobites
asaData <- getCladeTaxaPBDB("Asaphida")
asaTree <- makePBDBtaxonTree(
taxaDataPBDB = asaData,
rankTaxon = "genus",
method = "parentChild")
# plot it!
plotTaxaTreePBDB(asaTree)
# pause 3 seconds so we don't spam the API
Sys.sleep(3)
###############################
#Ornithischia
ornithData <- getCladeTaxaPBDB("Ornithischia")
ornithTree <- makePBDBtaxonTree(
taxaDataPBDB = ornithData,
rankTaxon = "genus",
method = "parentChild")
plotTaxaTreePBDB(ornithTree)
# pause 3 seconds so we don't spam the API
Sys.sleep(3)
#try Linnean!
#but first... need to drop repeated taxon first: Hylaeosaurus
# actually this taxon seems to have been repaired
# as of September 2019 !
# findHylaeo <- ornithData$taxon_name == "Hylaeosaurus"
# there's actually only one accepted ID number
# HylaeoIDnum <- unique(ornithData[findHylaeo,"taxon_no"])
# HylaeoIDnum
# so, take which one has occurrences listed
# dropThis <- which((ornithData$n_occs < 1) & findHylaeo)
# ornithDataCleaned <- ornithData[-dropThis,]
ornithTree <- makePBDBtaxonTree(
ornithData,
rankTaxon = "genus",
method = "Linnean")
plotTaxaTreePBDB(ornithTree)
# pause 3 seconds so we don't spam the API
Sys.sleep(3)
#########################
# Rhynchonellida
rynchData <- getCladeTaxaPBDB("Rhynchonellida")
rynchTree <- makePBDBtaxonTree(
taxaDataPBDB = rynchData,
rankTaxon = "genus",
method = "parentChild")
plotTaxaTreePBDB(rynchTree)
#some of these look pretty messy!
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab