ropensci / taxize

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

Error in retrieving GBIF backbone taxon ID using `get_gbifid()` #928

Open OndrejMottl opened 7 months ago

OndrejMottl commented 7 months ago

I got the following error trying to retrieve GBIF ID using get_gbifid():

r$> taxize::get_gbifid(
      sci = "Tithonia subg. Mirasolia Carl Heinrich 'Bipontinus' Schultz, 1856"   
    )
==  1 queries  ===============

Retrieving data for taxon 'Tithonia subg. Mirasolia Carl Heinrich 'Bipontinus' Sc'

Error in `[.data.frame`(x, , c(cols, other)) : undefined columns selected

Neither this works:

r$> taxize::get_gbifid_(
      sci = "Tithonia subg. Mirasolia Carl Heinrich 'Bipontinus' Schultz, 1856"   
    )

Retrieving data for taxon 'Tithonia subg. Mirasolia Carl Heinrich 'Bipontinus' Sc'

Error in `[.data.frame`(x, , c(cols, other)) : undefined columns selected

The name ( "Tithonia subg. Mirasolia Carl Heinrich 'Bipontinus' Schultz, 1856") was obtained directly from taxize::resolve().

Session info ```r - Session info ----------------------------------------------------------------- setting value version R version 4.2.3 (2023-03-15 ucrt) os Windows 10 x64 (build 22631) system x86_64, mingw32 ui RTerm language (EN) collate English_United Kingdom.1252 ctype English_United Kingdom.1252 tz Europe/Prague date 2024-04-08 pandoc 3.1.4 @ C:\\Users\\ondre\\AppData\\Local\\Pandoc\\pandoc.exe - Packages --------------------------------------------------------------------- ! package * version date (UTC) lib source ape 5.7-1 2023-03-13 [1] CRAN (R 4.2.3) assertthat 0.2.1 2019-03-21 [1] CRAN (R 4.2.3) bold 1.3.0 2023-05-02 [1] CRAN (R 4.2.3) brio 1.1.4 2023-12-10 [1] CRAN (R 4.2.3) cachem 1.0.8 2023-05-01 [1] CRAN (R 4.2.3) cli 3.6.1 2023-03-23 [1] CRAN (R 4.2.3) codetools 0.2-19 2023-02-01 [2] CRAN (R 4.2.3) conditionz 0.1.0 2019-04-24 [1] CRAN (R 4.2.3) crayon 1.5.2 2022-09-29 [1] CRAN (R 4.2.3) crul 1.4.0 2023-05-17 [1] CRAN (R 4.2.3) curl 5.1.0 2023-10-02 [1] CRAN (R 4.2.3) data.table 1.15.2 2024-02-29 [1] CRAN (R 4.2.3) desc 1.4.3 2023-12-10 [1] CRAN (R 4.2.3) devtools 2.4.5 2022-10-11 [1] CRAN (R 4.2.3) digest 0.6.31 2022-12-11 [1] CRAN (R 4.2.3) dplyr 1.1.4 2023-11-17 [1] CRAN (R 4.2.3) ellipsis 0.3.2 2021-04-29 [1] CRAN (R 4.2.3) fansi 1.0.5 2023-10-08 [1] CRAN (R 4.2.3) fastmap 1.1.1 2023-02-24 [1] CRAN (R 4.2.3) foreach 1.5.2 2022-02-02 [1] CRAN (R 4.2.3) fs 1.6.3 2023-07-20 [1] CRAN (R 4.2.3) generics 0.1.3 2022-07-05 [1] CRAN (R 4.2.3) glue 1.6.2 2022-02-24 [1] CRAN (R 4.2.3) hms 1.1.3 2023-03-21 [1] CRAN (R 4.2.3) htmltools 0.5.8 2024-03-25 [1] CRAN (R 4.2.3) htmlwidgets 1.6.4 2023-12-06 [1] CRAN (R 4.2.3) httpcode 0.3.0 2020-04-10 [1] CRAN (R 4.2.3) httpuv 1.6.11 2023-05-11 [1] CRAN (R 4.2.3) iterators 1.0.14 2022-02-05 [1] CRAN (R 4.2.3) janitor 2.2.0 2023-02-02 [1] CRAN (R 4.2.3) jsonlite 1.8.7 2023-06-29 [1] CRAN (R 4.2.3) later 1.3.1 2023-05-02 [1] CRAN (R 4.2.3) lattice 0.20-45 2021-09-22 [2] CRAN (R 4.2.3) lifecycle 1.0.4 2023-11-07 [1] CRAN (R 4.2.3) lubridate 1.9.2 2023-02-10 [1] CRAN (R 4.2.3) magrittr 2.0.3 2022-03-30 [1] CRAN (R 4.2.3) memoise 2.0.1 2021-11-26 [1] CRAN (R 4.2.3) mime 0.12 2021-09-28 [1] CRAN (R 4.2.0) miniUI 0.1.1.1 2018-05-18 [1] CRAN (R 4.2.3) nlme 3.1-162 2023-01-31 [2] CRAN (R 4.2.3) pillar 1.9.0 2023-03-22 [1] CRAN (R 4.2.3) pkgbuild 1.4.3 2023-12-10 [1] CRAN (R 4.2.3) pkgconfig 2.0.3 2019-09-22 [1] CRAN (R 4.2.3) pkgload 1.3.4 2024-01-16 [1] CRAN (R 4.2.3) profvis 0.3.8 2023-05-02 [1] CRAN (R 4.2.3) promises 1.2.0.1 2021-02-11 [1] CRAN (R 4.2.3) purrr 1.0.2 2023-08-10 [1] CRAN (R 4.2.3) R6 2.5.1 2021-08-19 [1] CRAN (R 4.2.3) Rcpp 1.0.11 2023-07-06 [1] CRAN (R 4.2.3) readr 2.1.4 2023-02-10 [1] CRAN (R 4.2.3) remotes 2.4.2.1 2023-07-18 [1] CRAN (R 4.2.3) rlang 1.1.2 2023-11-04 [1] CRAN (R 4.2.3) rprojroot 2.0.4 2023-11-05 [1] CRAN (R 4.2.3) rstudioapi 0.15.0 2023-07-07 [1] CRAN (R 4.2.3) sessioninfo 1.2.2 2021-12-06 [1] CRAN (R 4.2.3) shiny 1.7.4 2022-12-15 [1] CRAN (R 4.2.3) snakecase 0.11.1 2023-08-27 [1] CRAN (R 4.2.3) stringi 1.8.1 2023-11-13 [1] CRAN (R 4.2.3) stringr 1.5.1 2023-11-14 [1] CRAN (R 4.2.3) taxize 0.9.100 2022-04-22 [1] CRAN (R 4.2.3) VP taxospace * 0.0.9003 2023-07-12 [?] load_all() (on disk 0.0.0.9000) testthat * 3.2.1 2023-12-02 [1] CRAN (R 4.2.3) tibble 3.2.1 2023-03-20 [1] CRAN (R 4.2.3) tidyr 1.3.0 2023-01-24 [1] CRAN (R 4.2.3) tidyselect 1.2.0 2022-10-10 [1] CRAN (R 4.2.3) timechange 0.2.0 2023-01-11 [1] CRAN (R 4.2.3) triebeard 0.4.1 2023-03-04 [1] CRAN (R 4.2.3) tzdb 0.4.0 2023-05-12 [1] CRAN (R 4.2.3) urlchecker 1.0.1 2021-11-30 [1] CRAN (R 4.2.3) urltools 1.7.3 2019-04-14 [1] CRAN (R 4.2.3) usethis 2.2.3 2024-02-19 [1] CRAN (R 4.2.3) utf8 1.2.4 2023-10-22 [1] CRAN (R 4.2.3) uuid 1.2-0 2024-01-14 [1] CRAN (R 4.2.3) vctrs 0.6.4 2023-10-12 [1] CRAN (R 4.2.3) withr 3.0.0 2024-01-16 [1] CRAN (R 4.2.3) xml2 1.3.4 2023-04-27 [1] CRAN (R 4.2.3) xtable 1.8-4 2019-04-21 [1] CRAN (R 4.2.3) zoo 1.8-12 2023-04-13 [1] CRAN (R 4.2.3) [1] C:/Users/ondre/AppData/Local/R/win-library/4.2 [2] C:/Program Files/R/R-4.2.3/library V -- Loaded and on-disk version mismatch. P -- Loaded and on-disk path mismatch. ```
ggrittz commented 6 months ago

This issue is related to both quotation marks (') in Bipontinus. They need to be escaped with backslashes because of regex

> taxize::get_gbifid(
+   sci = "Tithonia subg. Mirasolia Carl Heinrich \\'Bipontinus\\' Schultz, 1856"   
+ )
══  1 queries  ═══════════════

Retrieving data for taxon 'Tithonia subg. Mirasolia Carl Heinrich \'Bipontinus\' Schultz, 1856'

More than one GBIF ID found for taxon 'Tithonia subg. Mirasolia Carl Heinrich \'Bipontinus\' Schultz, 1856'!

            Enter rownumber of taxon (other inputs will return 'NA'):

    gbifid                         scientificname  rank   status matchtype
1  8892593 Mirasolia Sch.Bip. ex Benth. & Hook.f. genus  SYNONYM     EXACT
2 11114626        Mirasolita Hermsen et al., 2014 genus ACCEPTED     FUZZY