diff --git a/R/datelife_query.R b/R/datelife_query.R index 3e5b3b78..417731e7 100644 --- a/R/datelife_query.R +++ b/R/datelife_query.R @@ -125,7 +125,7 @@ make_datelife_query <- function(input = c("Rhea americana", "Pterocnemia pennata species_list <- get_opentree_species(taxon_name = cleaned_names_tnrs$unique_name, ott_id = cleaned_names_tnrs$ott_id, synth_tree_only = TRUE) - cleaned_names <- species_list$species_names + cleaned_names <- unname(species_list$tnrs_names) ott_ids <- species_list$ott_ids } else { # example: df <- get_ott_children(ott_ids = 698424, ott_rank = "species") @@ -169,7 +169,11 @@ make_datelife_query <- function(input = c("Rhea americana", "Pterocnemia pennata ifelse(length(cleaned_names) <= 10, ".", paste("... omitted ", length(cleaned_names) - 10, "taxon names."))) - message("DateLife query done!\n") + if(length(cleaned_names) < 1) { + message("ERROR: No names retained for search\n") + } else{ + message("DateLife query made!\n") + } return(structure(datelife_query_return, class = "datelifeQuery")) } #' Process a phylo object or a character string to determine if it's correct newick diff --git a/R/opentree_taxonomy.R b/R/opentree_taxonomy.R index 2002a5a0..95fbd189 100644 --- a/R/opentree_taxonomy.R +++ b/R/opentree_taxonomy.R @@ -90,7 +90,7 @@ check_ott_input <- function(input = NULL, ott_ids = NULL, ...) { message(input) stop("OTT ids are NULL.") } - if (is.numeric(input$ott_id) & !is.na(input$ott_id)) { + if (all(is.numeric(input$ott_id) & !is.na(input$ott_id))) { ott_ids <- input$ott_ids names(ott_ids) <- input$cleaned_names } else {