Skip to content

Commit

Permalink
collapse valid_names to string and warn on no match found. #38
Browse files Browse the repository at this point in the history
  • Loading branch information
cboettig committed Apr 1, 2015
1 parent 8b3a1f9 commit fd558af
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions R/synonyms.R
Expand Up @@ -71,7 +71,10 @@ validate_names <- function(species_list, limit = 50, server = SERVER){
syn_table <- dplyr::filter_(syn_table, .dots = list(~Synonymy != "misapplied name"))
}
code <- unique(syn_table$SpecCode)


if(is.null(code))
warning(paste0("No match found for species '", x, "'"))

## Return the name listed as valid.
## Nope; doesn't work. eg. because the valid name for "Auxis rochei" is "Auxis rochei rochei",
## but a syn_table doesn't return any valid name, only the spec code.
Expand All @@ -83,6 +86,7 @@ validate_names <- function(species_list, limit = 50, server = SERVER){
speciesnames(code)

})
unname(out)
## sapply will still return nested lists if a value is missing
unname(unlist(out))
}

0 comments on commit fd558af

Please sign in to comment.