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

Error for read_camtrap_dp on example camtrapDP dataset #222

Closed
LisaNicvert opened this issue Jul 12, 2023 · 3 comments · Fixed by #223
Closed

Error for read_camtrap_dp on example camtrapDP dataset #222

LisaNicvert opened this issue Jul 12, 2023 · 3 comments · Fixed by #223
Assignees
Labels
enhancement New feature or request

Comments

@LisaNicvert
Copy link

Hello! I am trying to use camtrapDP for a package I am creating. When I try to read the camtrapDP example dataset (from https://github.com/tdwg/camtrap-dp/tree/1.0-rc.1/example), I get the following error:

> dat <- camtraptor::read_camtrap_dp("https://raw.githubusercontent.com/tdwg/camtrap-dp/1.0-rc.1/example/datapackage.json")
Please make sure you have the right to access data from this Data Package for your intended use.
Follow applicable norms or requirements to credit the dataset and its authors.
Error in `dplyr::relocate()`:                                                   
! Can't subset columns that don't exist.Column `cameraSetup` doesn't exist.
Run `rlang::last_trace()` to see where the error occurred.

Here is the output of rlang::last_trace:

> rlang::last_trace(drop = FALSE)
<error/vctrs_error_subscript_oob>
Error in `dplyr::relocate()`:
! Can't subset columns that don't exist.Column `cameraSetup` doesn't exist.
---
Backtrace:

  1. ├─camtraptor::read_camtrap_dp("https://raw.githubusercontent.com/tdwg/camtrap-dp/1.0-rc.1/example/datapackage.json")
  2. │ └─observations %>% ...
  3. ├─dplyr::relocate(., dplyr::one_of(cols_taxon_infos), .after = "cameraSetup")
  4. ├─dplyr:::relocate.data.frame(., dplyr::one_of(cols_taxon_infos), .after = "cameraSetup")
  5. │ └─dplyr:::eval_relocate(...)
  6. │   └─tidyselect::eval_select(after, data, env = env, error_call = error_call)
  7. │     └─tidyselect:::eval_select_impl(...)
  8. │       ├─tidyselect:::with_subscript_errors(...)
  9. │       │ └─rlang::try_fetch(...)
 10. │       │   └─base::withCallingHandlers(...)
 11. │       └─tidyselect:::vars_select_eval(...)
 12. │         └─tidyselect:::as_indices_sel_impl(...)
 13. │           └─tidyselect:::as_indices_impl(...)
 14. │             └─tidyselect:::chr_as_locations(x, vars, call = call, arg = arg)
 15. │               └─vctrs::vec_as_location(...)
 16. └─vctrs (local) `<fn>`()
 17.   └─vctrs:::stop_subscript_oob(...)
 18.     └─vctrs:::stop_subscript(...)
 19.       └─rlang::abort(...)

It used to work in the past, but it seems to be broken (maybe because I updated my version of R (4.1.xx -> 4.3.0) or maybe because the example dataset changed since I last tried).

Below is my session info:

> sessionInfo()
R version 4.3.0 (2023-04-21)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 20.04.6 LTS

Matrix products: default
BLAS:   /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.9.0 
LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.9.0

locale:
 [1] LC_CTYPE=fr_FR.UTF-8       LC_NUMERIC=C              
 [3] LC_TIME=fr_FR.UTF-8        LC_COLLATE=fr_FR.UTF-8    
 [5] LC_MONETARY=fr_FR.UTF-8    LC_MESSAGES=fr_FR.UTF-8   
 [7] LC_PAPER=fr_FR.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C            
[11] LC_MEASUREMENT=fr_FR.UTF-8 LC_IDENTIFICATION=C       

time zone: Europe/Paris
tzcode source: system (glibc)

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

loaded via a namespace (and not attached):
 [1] crayon_1.5.2       vctrs_0.6.3        httr_1.4.6         cli_3.6.1         
 [5] rlang_1.1.1        purrr_1.0.1        generics_0.1.3     assertthat_0.2.1  
 [9] jsonlite_1.8.5     glue_1.6.2         bit_4.0.5          hms_1.1.3         
[13] camtraptor_0.19.6  fansi_1.0.4        tibble_3.2.1       tzdb_0.4.0        
[17] lifecycle_1.0.3    compiler_4.3.0     dplyr_1.1.2        pkgconfig_2.0.3   
[21] rstudioapi_0.14    R6_2.5.1           readr_2.1.4        tidyselect_1.2.0  
[25] utf8_1.2.3         parallel_4.3.0     vroom_1.6.3        pillar_1.9.0      
[29] curl_5.0.1         magrittr_2.0.3     frictionless_1.0.2 withr_2.5.0       
[33] tools_4.3.0        bit64_4.0.5   

Do you know what is going on? Thanks!

@LisaNicvert LisaNicvert changed the title Error for read_camtrap_df on example camtrapDP dataset Error for read_camtrap_dp on example camtrapDP dataset Jul 12, 2023
@LisaNicvert LisaNicvert changed the title Error for read_camtrap_dp on example camtrapDP dataset Error for read_camtrap_dp on example camtrapDP dataset Jul 12, 2023
@damianooldoni damianooldoni self-assigned this Jul 12, 2023
@damianooldoni
Copy link
Member

Hi Lisa! Thanks for reaching us.

The problem is that the example dataset changed, indeed. As you see, the version mentioned in the link is "v1.0-rc.1".

We are working on allowing camtraptor to read cameratrap datapackages written following version 1.0-rc.1, where rc-1 stays for release candidate number 1. Up to now, camtraptor supports data using camtrap-dp format version 0.1.6. If you are using Agouti, notice that the legacy Agouti exports are not yet written following version 1.0-rc.1.

We are tackling this issue (#196) in PR #223 (still a draft, work in progress). It will be solved asap (= very likely next few days, for sure in July).

I hope I could clearly answer to your question.

@PietrH PietrH linked a pull request Jul 13, 2023 that will close this issue
@PietrH PietrH added the enhancement New feature or request label Jul 13, 2023
@LisaNicvert
Copy link
Author

Thank you for your answer, it's clearer now. I noticed the issue #196 you linked in your answer, but I was unsure this was linked to my problem. Sorry for the duplicate!

@damianooldoni
Copy link
Member

No worries! 👍

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

Successfully merging a pull request may close this issue.

3 participants