ropensci / taxize

A taxonomic toolbelt for R
https://docs.ropensci.org/taxize
Other
270 stars 61 forks source link

Downto error #885

Open rogmei opened 3 years ago

rogmei commented 3 years ago

Hi, I really find the taxize package useful, but now I am encountering a bug that seems to be similar to those found in cases #847, #824 and #821. This is related to finding all species in the group Osteichthyes. Other groups like Agnatha and Chondrichthyes works fine. Libraries tidyverse, taxize and rentrez are loaded.

Code snippet that fails is as follows: var_output_taxrank = "species" var_input_taxranks <- c('Osteichthyes') options(max.print = 1000000) wi <- bind_rows(getwormsid(sci_com = c(var_input_taxranks), searchtype = "scientific", marine_only = TRUE)) downstream(sci_id = as_vector(select(wi, AphiaID)), db = 'worms', downto = var_output_taxrank, intermediate = FALSE ) %>% data.table::rbindlist() -> wormsids_atrank

Error message: Error in vapply(x$rank, function(z) which_rank(z, zoo = zoo), 1) : values must be length 1, but FUN(X[[1]]) result is length 0

zachary-foster commented 3 years ago

Thanks for the info! This was caused by the rank "gigaclass" not being in the rank reference used to determine the relative order of taxonomic ranks from names. I have added the "gigaclass" to the rank ref and made a more informative error message for when this happens again. You can try out the change by installing this version that will be pushed to CRAN soon hopefully, but note this version has many other changes and might break other code.

install.packages("remotes")
remotes::install_github("ropensci/taxize")