Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

issues with validate_names #266

Open
danagrieco opened this issue Jun 8, 2023 · 8 comments
Open

issues with validate_names #266

danagrieco opened this issue Jun 8, 2023 · 8 comments

Comments

@danagrieco
Copy link

Hi rfishbase,

I'm having an issue with the validate_names, and I can't seem to figure it out. I ran the code about two weeks ago, and was able to use validate_names with my dataset, and it worked perfectly. Now, before even getting to my dataset, I try to run the simple code, below, to make sure validate names is working, and it produces the following error, below:

validate_names("Abramites ternetzi")

Error in purrr::map_chr():
i In index: 1.
Caused by error:
! Result must be length 1, not 2.

Run rlang::last_trace() to see where the error occurred.

rlang::last_trace()
<error/purrr_error_indexed>


Backtrace:
x

  1. +-rfishbase::validate_names("Abramites ternetzi")
  2. | +-... %>% dplyr::pull(Species)
  3. | -rfishbase::synonyms(...)
  4. | +-... %>% ...
  5. | -rfishbase::fb_tbl("synonyms", server, version, db)
  6. | -rfishbase::fb_import(server, version, db, tbl)
  7. | +-rfishbase:::parse_prov(read_prov(server), version)
  8. | | +-base::withVisible(eval(mc, parent.frame()))
  9. | | -base::eval(mc, parent.frame())
  10. | | -base::eval(mc, parent.frame())
  11. | -rfishbase (local) <fn>(prov = read_prov(server), version = version)
  12. | -tibble::tibble(...)
  13. | -tibble:::tibble_quos(xs, .rows, .name_repair)
  14. | -rlang::eval_tidy(xs[[j]], mask)
  15. +-dplyr::pull(., Species)
  16. +-dplyr::left_join(x = tmp, y = ., by = "synonym")
  17. +-dplyr:::left_join.data.frame(x = tmp, y = ., by = "synonym")
  18. | -dplyr::auto_copy(x, y, copy = copy)
  19. | +-dplyr::same_src(x, y)
  20. | -dplyr:::same_src.data.frame(x, y)
  21. | -base::is.data.frame(y)
  22. +-dplyr::distinct(.)
  23. +-dplyr::select(., synonym, Species)
  24. +-dplyr::ungroup(.)
  25. +-dplyr::filter(., !is.na(Species))
  26. +-dplyr::group_by(., synonym)
  27. +-dplyr::mutate(...)
  28. +-dplyr::collect(.)
  29. +-dplyr::select(...)
  30. +-dplyr::mutate(., synonym = paste(SynGenus, SynSpecies))
  31. +-purrr::map_chr(meta, "encodingFormat", .default = NA)
  32. | -purrr:::map_("character", .x, .f, ..., .progress = .progress)
  33. | +-purrr:::with_indexed_errors(...)
  34. | | -base::withCallingHandlers(...)
  35. | -purrr:::call_with_cleanup(...)
  36. -base::.handleSimpleError(...)
  37. -purrr (local) h(simpleError(msg, call))
  38. \-cli::cli_abort(...)
    
  39.   \-rlang::abort(...)>
    
@cboettig
Copy link
Member

cboettig commented Jun 8, 2023 via email

@sollucas
Copy link

Hi, I'm also having a problem with validate_names as well. I've updated both the package and R today - I'd last run the code in May and it had worked then. Any advice on the following error appreciated:

validate_names("Abramites ternetzi")

Error in (function (cond) :
error in evaluating the argument 'conn' in selecting a method for function 'dbListTables': [UNKNOWN] Failed to stat ':memory:': unknown error

@cboettig
Copy link
Member

@sollucas sorry but I'm unable to reproduce the behavior you're seeing. Can you try first purging the cache:

 rfishbase::db_dir()  |> unlink()

Can you please provide more information, including sessionInfo() output after loading rfishbase?

please ensure related dependencies are up-to-date -- eg. consider using pak::pkg_install("rfishbase", upgrade=TRUE).

@sollucas
Copy link

Thanks for the response - I've tried the suggestions and unfortunately still getting the same error:

rfishbase::db_dir()  |> unlink() 

Warning message:
R graphics engine version 16 is not supported by this version of RStudio. The Plots tab will be disabled until a newer version of RStudio is installed.

library(rfishbase) 
sessionInfo() 

R version 4.3.1 (2023-06-16 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 Kingdom.1252 LC_CTYPE=English_United Kingdom.1252 LC_MONETARY=English_United Kingdom.1252
[4] LC_NUMERIC=C LC_TIME=English_United Kingdom.1252

time zone: Europe/London
tzcode source: internal

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

other attached packages:
[1] rfishbase_4.1.2

loaded via a namespace (and not attached):
[1] crayon_1.5.2 vctrs_0.6.3 cli_3.6.1 rlang_1.1.1 xfun_0.39 stringi_1.7.12 DBI_1.1.3 purrr_1.0.1
[9] generics_0.1.3 glue_1.6.2 prettyunits_1.1.1 dbplyr_2.3.2 tinytex_0.45 hms_1.1.3 fansi_1.0.4 tibble_3.2.1
[17] tzdb_0.4.0 progress_1.2.2 lifecycle_1.0.3 stringr_1.5.0 compiler_4.3.1 dplyr_1.1.2 fs_1.6.2 pkgconfig_2.0.3
[25] rstudioapi_0.14 R6_2.5.1 readr_2.1.4 tidyselect_1.2.0 utf8_1.2.3 pillar_1.9.0 magrittr_2.0.3 tools_4.3.1

pak::pkg_install("rfishbase", upgrade=TRUE)

✔ Loading metadata database ... done

ℹ No downloads are needed
✔ 1 pkg + 47 deps: kept 48 [27.6s]

library(rfishbase)
validate_names("Abramites ternetzi")

Error in (function (cond) :
error in evaluating the argument 'conn' in selecting a method for function 'dbListTables': [UNKNOWN] Failed to stat ':memory:': unknown error

@cboettig
Copy link
Member

note taht you will need to restart R after installing/upgrade packages. I'm very confused why certain packages are not being listed in your sessionInfo() : in particular, duckdb is a required package for rfishbase and I don't see it there....

can you try installing and loading duckdb manually first?

@cboettig
Copy link
Member

(aside, but is your RStudio version up-to-date as well?)

@sollucas
Copy link

sollucas commented Jul 4, 2023

Updated R Studio today (version 2023.06.0)
R version 4.3.1 (2023-06-16 ucrt) -- "Beagle Scouts"
Manually installed 2 missing packages: duckdb and contentid.
Restarted my laptop after updating/installing the above and have tried restarting R sessions, with the same error appearing:

library(rfishbase) 
library(duckdb)
library(contentid)
sessionInfo()

R version 4.3.1 (2023-06-16 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 Kingdom.utf8 LC_CTYPE=English_United Kingdom.utf8
[3] LC_MONETARY=English_United Kingdom.utf8 LC_NUMERIC=C
[5] LC_TIME=English_United Kingdom.utf8

time zone: Europe/London
tzcode source: internal

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

other attached packages:
[1] contentid_0.0.17 duckdb_0.8.1 DBI_1.1.3 rfishbase_4.1.2

loaded via a namespace (and not attached):
[1] jsonlite_1.8.5 dplyr_1.1.2 compiler_4.3.1 crayon_1.5.2
[5] tidyselect_1.2.0 stringr_1.5.0 progress_1.2.2 fastmap_1.1.1
[9] readr_2.1.4 R6_2.5.1 generics_0.1.3 curl_5.0.1
[13] tibble_3.2.1 openssl_2.0.6 pillar_1.9.0 tzdb_0.4.0
[17] rlang_1.1.1 utf8_1.2.3 cachem_1.0.8 stringi_1.7.12
[21] fs_1.6.2 memoise_2.0.1 cli_3.6.1 magrittr_2.0.3
[25] rstudioapi_0.14 dbplyr_2.3.2 hms_1.1.3 askpass_1.1
[29] lifecycle_1.0.3 prettyunits_1.1.1 vctrs_0.6.3 glue_1.6.2
[33] fansi_1.0.4 purrr_1.0.1 httr_1.4.6 tools_4.3.1
[37] pkgconfig_2.0.3

validate_names("Abramites ternetzi")

Error in (function (cond) :
error in evaluating the argument 'conn' in selecting a method for function 'dbListTables': [UNKNOWN] Failed to stat ':memory:': unknown error

@sollucas
Copy link

sollucas commented Jul 6, 2023

Hi again - I copied my files to a different drive and am no longer getting the error. Apologies, think this was an issue with the original drive I was using. Thanks very much for your help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants