Error with occ_search when searching for many occurrences



I am trying to download occurrence data for a series of species from 1970 - 2021. Right now I am capping it at 50,000 occurrences. To do this I am using the rgbif::occ_search() function. When I run the function for many of my species I get an error that seems like it is due to an issue within the function when the result is being compiled. This error does not occur when I limit the occurrences to only 50.


temp <- occ_search(taxonKey = 2498073, limit = 50, geometry = NULL, year = "1970,2021")

Does not work:

temp <- occ_search(taxonKey = 2498073, limit = 50000, geometry = NULL, year = "1970,2021")

The error I get is:

Error in (function (..., row.names = NULL, check.rows = FALSE, check.names = TRUE,  : 
   arguments imply differing number of rows: 1, 0

and I cannot seem to trace this error to its source.

I am sorry if this is not the appropriate place to put this issue.

Thank you for your help!

Session Info:

Session Info

R version 4.0.3 (2020-10-10)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19041)

Matrix products: default

[1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United States.1252   
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C                          
[5] LC_TIME=English_United States.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] rgbif_3.3.0   taxize_0.9.99

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.5        pillar_1.4.6      compiler_4.0.3    plyr_1.8.6        iterators_1.0.13  tools_4.0.3      
 [7] uuid_0.1-4        nlme_3.1-150      jsonlite_1.7.1    lifecycle_0.2.0   tibble_3.0.4      gtable_0.3.0     
[13] lattice_0.20-41   pkgconfig_2.0.3   rlang_0.4.8       foreach_1.5.1     cli_2.1.0         rstudioapi_0.11  
[19] curl_4.3          crul_1.0.0        parallel_4.0.3    dplyr_1.0.2       httr_1.4.2        stringr_1.4.0    
[25] xml2_1.3.2        generics_0.1.0    vctrs_0.3.4       rgeos_0.5-5       triebeard_0.3.0   grid_4.0.3       
[31] tidyselect_1.1.0  reshape_0.8.8     httpcode_0.3.0    glue_1.4.2        data.table_1.13.2 geoaxe_0.1.0     
[37] R6_2.5.0          fansi_0.4.1       oai_0.3.0         conditionz_0.1.0  sp_1.4-4          ggplot2_3.3.2    
[43] purrr_0.3.4       magrittr_1.5      whisker_0.4       urltools_1.7.3    codetools_0.2-16  scales_1.1.1     
[49] ellipsis_0.3.1    assertthat_0.2.1  bold_1.1.0        ape_5.4-1         colorspace_1.4-1  utf8_1.1.4       
[55] stringi_1.4.6     lazyeval_0.2.2    munsell_0.5.0     crayon_1.3.4      zoo_1.8-8  
1 Like

Thanks for your question @gledits2

That’s probably been fixed - the version you are using is from September 2020. There’s been 3 versions of rgbif since then. Install like install.packages("rgbif") to get the latest version. Try again after installing the latest and let me know what happens

Thanks @sckott for the quick reply! 3 versions since September… wow!

I tried to update rgbif (through RStudio) after reading another blog post and it still did not work. However, when I coded the reinstall as you suggested it worked! I guess I will no longer be updating packages with RStudio.

Thanks again and I am super happy everything is working now!

Interesting. I’ve got no ideas about why that would or wouldn’t work in RStudio. Glad it works for you now.

If you’re interested, there’s a number of ways you can find out about new rgbif versions: