brunobrr / bdc

Check out the vignettes with detailed documentation on each module of the bdc package
https://brunobrr.github.io/bdc
GNU General Public License v3.0
23 stars 7 forks source link

bdc_clean_names #230

Closed oliveirab closed 1 year ago

oliveirab commented 2 years ago

Hi folks, I've been trying to use bdc_clean_names and I am getting the following error message:

head(splist$species_original)
[1] "Erithacus rubecula" "Regulus regulus"    "Turdus viscivorus"  "Parus major"        "Parus cristatus"   
[6] "Dendrocopos major" 
clean_names <- bdc_clean_names(splist$species_original)
The latest gnparser version is v1.6.5
Error in utils::download.file(grep(os, urls, value = TRUE), file, mode = "wb") : 
  lengths of 'url' and 'destfile' must match

I appreciate any guidance.

kguidonimartins commented 2 years ago

Hi @oliveirab! Thanks for reporting this issue. Please, could you provide the results of sessionInfo()?

oliveirab commented 2 years ago

Yep!

sessionInfo()
R version 4.2.1 (2022-06-23 ucrt)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19044)

Matrix products: default

locale:
[1] LC_COLLATE=English_United States.utf8  LC_CTYPE=English_United States.utf8   
[3] LC_MONETARY=English_United States.utf8 LC_NUMERIC=C                          
[5] LC_TIME=English_United States.utf8    

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

other attached packages:
 [1] bdc_1.1.1           ggrepel_0.9.1       rcol_0.2.0          taxadb_0.1.5       
 [5] taxizedb_0.3.0      taxize_0.9.100      rinat_0.1.8         rvertnet_0.8.2     
 [9] pbapply_1.5-0       traitdataform_0.6.8 writexl_1.4.0       googledrive_2.0.0  
[13] readxl_1.4.0        forcats_0.5.1       stringr_1.4.0       purrr_0.3.4        
[17] readr_2.1.2         tidyr_1.2.0         tibble_3.1.7        tidyverse_1.3.1    
[21] ggvenn_0.1.9        ggplot2_3.3.6       DT_0.22             dplyr_1.0.9        
[25] knitr_1.39          data.table_1.14.2  

loaded via a namespace (and not attached):
  [1] uuid_1.1-0               backports_1.4.1          plyr_1.8.7              
  [4] lazyeval_0.2.2           sp_1.4-7                 crosstalk_1.2.0         
  [7] RApiSerialize_0.1.0      digest_0.6.29            foreach_1.5.2           
 [10] htmltools_0.5.2          fansi_1.0.3              magrittr_2.0.3          
 [13] memoise_2.0.1            tzdb_0.3.0               modelr_0.1.8            
 [16] RcppParallel_5.1.5       duckdb_0.3.4             askpass_1.1             
 [19] prettyunits_1.1.1        colorspace_2.0-3         blob_1.2.3              
 [22] rvest_1.0.2              rappdirs_0.3.3           hoardr_0.5.2.93         
 [25] haven_2.5.0              xfun_0.30                rgdal_1.5-31            
 [28] crayon_1.5.1             RCurl_1.98-1.6           jsonlite_1.8.0          
 [31] stringfish_0.15.7        zoo_1.8-10               iterators_1.0.14        
 [34] ape_5.6-2                glue_1.6.2               gtable_0.3.0            
 [37] gargle_1.2.0             maps_3.4.0               arkdb_0.0.15            
 [40] scales_1.2.0             oai_0.3.2                contentid_0.0.15        
 [43] DBI_1.1.2                miniUI_0.1.1.1           Rcpp_1.0.8.3            
 [46] xtable_1.8-4             progress_1.2.2           units_0.8-0             
 [49] proxy_0.4-26             bit_4.0.4                bold_1.2.0              
 [52] rgbif_3.7.2              htmlwidgets_1.5.4        httr_1.4.3              
 [55] geosphere_1.5-14         ellipsis_0.3.2           farver_2.1.0            
 [58] pkgconfig_2.0.3          reshape_0.8.9            XML_3.99-0.9            
 [61] sass_0.4.1               dbplyr_2.1.1             utf8_1.2.2              
 [64] here_1.0.1               conditionz_0.1.0         crul_1.2.0              
 [67] labeling_0.4.2           tidyselect_1.1.2         rlang_1.0.2             
 [70] reshape2_1.4.4           later_1.3.0              munsell_0.5.0           
 [73] cellranger_1.1.0         tools_4.2.1              cachem_1.0.6            
 [76] cli_3.3.0                generics_0.1.2           RSQLite_2.2.14          
 [79] broom_0.8.0              evaluate_0.15            fastmap_1.1.0           
 [82] sys_3.4                  yaml_2.3.5               bit64_4.0.5             
 [85] fs_1.5.2                 nlme_3.1-157             whisker_0.4             
 [88] mime_0.12                xml2_1.3.3               compiler_4.2.1          
 [91] rstudioapi_0.13          curl_4.3.2               e1071_1.7-9             
 [94] reprex_2.0.1             bslib_0.3.1              stringi_1.7.6           
 [97] rgeos_0.5-9              rgnparser_0.2.0          lattice_0.20-45         
[100] classInt_0.4-3           vctrs_0.4.1              pillar_1.7.0            
[103] lifecycle_1.0.1          jquerylib_0.1.4          bitops_1.0-7            
[106] raster_3.5-15            httpuv_1.6.5             R6_2.5.1                
[109] qs_0.25.3                promises_1.2.0.1         KernSmooth_2.23-20      
[112] codetools_0.2-18         assertthat_0.2.1         openssl_2.0.0           
[115] CoordinateCleaner_2.0-20 rprojroot_2.0.3          withr_2.5.0             
[118] rcrossref_1.1.0          httpcode_0.3.0           rnaturalearth_0.1.0     
[121] hms_1.1.1                terra_1.5-21             class_7.3-20            
[124] suppdata_1.1-8           rmarkdown_2.14           sf_1.0-7                
[127] getPass_0.2-2            shiny_1.7.1              lubridate_1.8.0  
kguidonimartins commented 2 years ago

I guess this could be an error from {rgnparser}. Please, try the standalone installation of gnparser and run bdc::bdc_clean_names() again. Follow the steps below:

## install/load `rgnparser`
if (!require("rgnparser")) install.packages("rgnparser")

## install the gnparser binary
rgnparser::install_gnparser()

## run `bdc::bdc_clean_names()` again with your species list.
oliveirab commented 2 years ago

I doesn't seem to be working...

if (!require("rgnparser")) install.packages("rgnparser")
Loading required package: rgnparser

Attaching package: ‘rgnparser’

The following object is masked from ‘package:taxize’:

    gn_parse

rgnparser::install_gnparser()
The latest gnparser version is v1.6.5
Error in utils::download.file(grep(os, urls, value = TRUE), file, mode = "wb") : 
  lengths of 'url' and 'destfile' must match
bdc::bdc_clean_names(splist$species_original[1:100])
The latest gnparser version is v1.6.5
Error in utils::download.file(grep(os, urls, value = TRUE), file, mode = "wb") : 
  lengths of 'url' and 'destfile' must match
kguidonimartins commented 2 years ago

Thanks again, @oliveirab! Pretty sure this is a rgnparser problem. We can try a few tests if you want. The first one is to reinstall the rgnparser from our fork. I made little changes to prevent errors you are reporting, like:

Error in utils::download.file(grep(os, urls, value = TRUE), file, mode = "wb") : lengths of 'url' and 'destfile' must match

Reload your R session (close and reopen the RStudio for example) before trying the following steps:

## reinstall `rgnparser`
if (!require("remotes")) install.packages("remotes")
remotes::install_github("bdc-proj/rgnparser", force = TRUE)

## install the gnparser binary
rgnparser::install_gnparser()

## rerun your consult using `bdc`
bdc::bdc_clean_names(splist$species_original[1:100])
hazeljanderson commented 1 year ago

@oliveirab this is an old issue so not sure if you have moved on or found a workaround by now. This seems to be a common issue and I found this article helpful which suggests using wininet options(download.file.method = "wininet")

kguidonimartins commented 1 year ago

Thanks, @hazeljanderson! Maybe that option could solve the problem. As you note, this is an old issue without any activity in the last few months. I'm proposing to close this issue for now. But feel free to open it again when needed.