Skip to content

Commit

Permalink
handling taxize issues
Browse files Browse the repository at this point in the history
  • Loading branch information
bomeara committed Jul 11, 2019
1 parent 6d297c4 commit 1a0b978
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
8 changes: 6 additions & 2 deletions R/dataFunctions.R
Original file line number Diff line number Diff line change
Expand Up @@ -160,13 +160,17 @@ aggregate_category <- function(locations, focal='realm', group_by = "taxon", ret
#' @return vector of species names
#' @export
descendant_species <- function(taxon) {
species <- c()
#col_id <- taxize::gnr_resolve(taxon, data_source_ids=1, ask=FALSE, fields="all", best_match_only=TRUE)

#col_id <- taxize::get_colid_(taxon)[[1]]$id[1]
#species <- taxize::downstream(col_id, downto = "species", db = "col")[[1]]$childtaxa_name

gbif_id <- taxize::get_gbifid_(taxon)[[1]]$usagekey[1]
species <- taxize::downstream(gbif_id, downto = "species", db = "gbif", limit=1000)[[1]]$name
try(gbif_id <- taxize::get_gbifid_(taxon)[[1]]$usagekey[1])
try(species <- taxize::downstream(gbif_id, downto = "species", db = "gbif", limit=1000)[[1]]$name)
if(length(species)==0) {
try(species <- downstream("Onthophagus", db = 'itis', downto = 'species')[[1]]$taxonname)
}
return(species)
}

Expand Down
2 changes: 1 addition & 1 deletion man/spocc_taxon_query.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 1a0b978

Please sign in to comment.