# Note that most examples here using getPBDBocc()
# use the argument 'failIfNoInternet = FALSE'
# so that functions do not error out
# but simply return NULL if internet
# connection is not available, and thus
# fail gracefully rather than error out (required by CRAN).
# Remove this argument or set to TRUE so functions DO fail
# when internet resources (paleobiodb) is not available.
# \donttest{
# getting occurrence data for a genus, sorting it
# firest example: Dicellograptus
dicelloData <- getPBDBocc("Dicellograptus",
failIfNoInternet = FALSE)
if(!is.null(dicelloData)){
dicelloOcc2 <- taxonSortPBDBocc(
data = dicelloData,
rank = "species",
onlyFormal = FALSE
)
names(dicelloOcc2)
}
# try a PBDB API download with lots of synonymization
#this should have only 1 species
# *old* way, using v1.1 of PBDB API:
# acoData <- read.csv(paste0(
# "https://paleobiodb.org/data1.1/occs/list.txt?",
# "base_name = Acosarina%20minuta&show=ident,phylo"))
#
# *new* method - with getPBDBocc, using v1.2 of PBDB API:
acoData <- getPBDBocc("Acosarina minuta",
failIfNoInternet = FALSE)
if(!is.null(acoData)){
acoOcc <- taxonSortPBDBocc(
data = acoData,
rank = "species",
onlyFormal = FALSE
)
names(acoOcc)
}
# }
###########################################
#load example graptolite PBDB occ dataset
data(graptPBDB)
#get formal genera
occGenus <- taxonSortPBDBocc(
data = graptOccPBDB,
rank = "genus"
)
length(occGenus)
#get formal species
occSpeciesFormal <- taxonSortPBDBocc(
data = graptOccPBDB,
rank = "species")
length(occSpeciesFormal)
#yes, there are fewer 'formal'
# graptolite species in the PBDB then genera
#get formal and informal species
occSpeciesInformal <- taxonSortPBDBocc(
data = graptOccPBDB,
rank = "species",
onlyFormal = FALSE
)
length(occSpeciesInformal)
#way more graptolite species are 'informal' in the PBDB
#get formal and informal species
#including from occurrences with uncertain taxonomy
#basically everything and the kitchen sink
occSpeciesEverything <- taxonSortPBDBocc(
data = graptOccPBDB,
rank = "species",
onlyFormal = FALSE,
cleanUncertain = FALSE)
length(occSpeciesEverything)
Run the code above in your browser using DataLab