v0.5.0.9000 -> v0.6.1: `read_opus()` fails
Closed this issue · 6 comments
I do not write issues often, so if I omitted something or the format is bad, sorry about that.
I usually pipe and map the opus_read function like this. I had to do an update today and reinstall the package. Apparently there were some changes that now lead to this error.
opus_lst <- list.dirs("C:/Users/iostovary/2023_Phenology_and_everything", full.names = TRUE) %>%
- map(~read_opus(dsn = .x, parallel = TRUE, data_only = FALSE)) %>%
- bind_rows() %>%
- select(-matches("add_sample_id"))
Error inmap()
:
ℹ In index: 1.
Caused by error inUseMethod()
:
! nicht anwendbare Methode für 'calc_parameter_chunk_size' auf Objekt der Klasse "parameter" angewendet
Backtrace:
- ... %>% select(-matches("add_sample_id"))
- purrr::map(., ~read_opus(dsn = .x, parallel = TRUE, data_only = FALSE))
- purrr:::map_("list", .x, .f, ..., .progress = .progress)
- .f(.x[[i]], ...)
- opusreader2::read_opus(dsn = .x, parallel = TRUE, data_only = FALSE)
... - future:::value.list(fs)
- future:::resolve.list(...)
- future (local) signalConditionsASAP(obj, resignal = FALSE, pos = ii)
- future:::signalConditions(...)
- base::stop(condition)
I also tried reading a single folder and a single file, both failed with the same error. I did it with the last three R versions (4.3.2, 4.3.1., 4.2.3) and RStudio 2023.09.1 Build 494
I reinstalled the tag opusreader2_v0.5.0.9000 and it works again. Just wanted to let you know.
a little tip just for formatting code here, you can use this
# uncomment below
# ```r
# your R code
# ```
sessionInfo()
# or
sessioninfo::session_info()
are really helpful for diangnostics.
For reproducible examples, I reprex is useful. Because reverse engineering is quite tricky, we really need OPUS files posted for full reproducibility.
can confirm your issue, we have test running on files. I think I have messed up something. We had devtools::check()
on GitHub actions before, but I updated the CI and apparently forgot to add.
Here is my local output on the test files to confirm.
> library(opusreader2)
> devtools::test()
ℹ Testing opusreader2
✔ | F W S OK | Context
✔ | 6 | create_dataset
✔ | 4 | parse_header
✖ | 1 0 | read_opus
───────────────────────────────────────────────────────────────────────────────────────────────────────────────
Error (test-read_opus.R:2:3): all test files are parsed without warning
Error in `UseMethod("calc_parameter_chunk_size")`: no applicable method for 'calc_parameter_chunk_size' applied to an object of class "parameter"
Backtrace:
▆
1. ├─testthat::expect_no_warning(read_opus(dsn = "../../inst/extdata/test_data")) at test-read_opus.R:2:3
2. │ └─testthat:::expect_no_(...)
3. │ └─testthat:::quasi_capture(enquo(object), NULL, capture)
4. │ ├─testthat (local) .capture(...)
5. │ │ └─rlang::try_fetch(...)
6. │ │ └─base::withCallingHandlers(...)
7. │ └─rlang::eval_bare(quo_get_expr(.quo), quo_get_env(.quo))
8. └─opusreader2::read_opus(dsn = "../../inst/extdata/test_data")
9. └─opusreader2:::opus_lapply(dsn, data_only) at opusreader2/R/read_opus.R:152:5
10. └─base::lapply(...) at opusreader2/R/read_opus.R:237:3
11. └─opusreader2 (local) FUN(X[[i]], ...)
12. └─opusreader2::read_opus_single(x, data_only) at opusreader2/R/read_opus.R:240:7
13. └─opusreader2:::parse_opus(raw, data_only) at opusreader2/R/read_opus.R:213:3
14. └─base::lapply(dataset_list, calc_parameter_chunk_size) at opusreader2/R/parse_opus.R:148:5
15. └─opusreader2 (local) FUN(X[[i]], ...)
───────────────────────────────────────────────────────────────────────────────────────────────────────────────
══ Results ════════════════════════════════════════════════════════════════════════════════════════════════════
── Failed tests ───────────────────────────────────────────────────────────────────────────────────────────────
Error (test-read_opus.R:2:3): all test files are parsed without warning
Error in `UseMethod("calc_parameter_chunk_size")`: no applicable method for 'calc_parameter_chunk_size' applied to an object of class "parameter"
Backtrace:
▆
1. ├─testthat::expect_no_warning(read_opus(dsn = "../../inst/extdata/test_data")) at test-read_opus.R:2:3
2. │ └─testthat:::expect_no_(...)
3. │ └─testthat:::quasi_capture(enquo(object), NULL, capture)
4. │ ├─testthat (local) .capture(...)
5. │ │ └─rlang::try_fetch(...)
6. │ │ └─base::withCallingHandlers(...)
7. │ └─rlang::eval_bare(quo_get_expr(.quo), quo_get_env(.quo))
8. └─opusreader2::read_opus(dsn = "../../inst/extdata/test_data")
9. └─opusreader2:::opus_lapply(dsn, data_only) at opusreader2/R/read_opus.R:152:5
10. └─base::lapply(...) at opusreader2/R/read_opus.R:237:3
11. └─opusreader2 (local) FUN(X[[i]], ...)
12. └─opusreader2::read_opus_single(x, data_only) at opusreader2/R/read_opus.R:240:7
13. └─opusreader2:::parse_opus(raw, data_only) at opusreader2/R/read_opus.R:213:3
14. └─base::lapply(dataset_list, calc_parameter_chunk_size) at opusreader2/R/parse_opus.R:148:5
15. └─opusreader2 (local) FUN(X[[i]], ...)
[ FAIL 1 | WARN 0 | SKIP 0 | PASS 10 ]
> sessioninfo::session_info()
─ Session info ──────────────────────────────────────────────────────────────────────────────────────────────
setting value
version R version 4.3.2 (2023-10-31)
os macOS Sonoma 14.2.1
system aarch64, darwin20
ui RStudio
language (EN)
collate en_US.UTF-8
ctype en_US.UTF-8
tz Europe/Zurich
date 2023-12-23
rstudio 2023.09.1+494 Desert Sunflower (desktop)
pandoc 3.1.1 @ /Applications/RStudio.app/Contents/Resources/app/quarto/bin/tools/ (via rmarkdown)
─ Packages ──────────────────────────────────────────────────────────────────────────────────────────────────
! package * version date (UTC) lib source
brio 1.1.4 2023-12-10 [1] CRAN (R 4.3.1)
cachem 1.0.8 2023-05-01 [1] CRAN (R 4.3.0)
callr 3.7.3 2022-11-02 [1] CRAN (R 4.3.0)
cli 3.6.2 2023-12-11 [1] CRAN (R 4.3.1)
curl 5.2.0 2023-12-08 [1] CRAN (R 4.3.1)
desc 1.4.3 2023-12-10 [1] CRAN (R 4.3.1)
devtools 2.4.5 2022-10-11 [1] CRAN (R 4.3.0)
digest 0.6.33 2023-07-07 [1] CRAN (R 4.3.0)
ellipsis 0.3.2 2021-04-29 [1] CRAN (R 4.3.0)
evaluate 0.23 2023-11-01 [1] CRAN (R 4.3.1)
fansi 1.0.6 2023-12-08 [1] CRAN (R 4.3.1)
fastmap 1.1.1 2023-02-24 [1] CRAN (R 4.3.0)
fs 1.6.3 2023-07-20 [1] CRAN (R 4.3.0)
glue 1.6.2 2022-02-24 [1] CRAN (R 4.3.0)
htmltools 0.5.7 2023-11-03 [1] CRAN (R 4.3.1)
htmlwidgets 1.6.4 2023-12-06 [1] CRAN (R 4.3.1)
httpuv 1.6.13 2023-12-06 [1] CRAN (R 4.3.1)
knitr 1.45 2023-10-30 [1] CRAN (R 4.3.1)
later 1.3.2 2023-12-06 [1] CRAN (R 4.3.1)
lifecycle 1.0.4 2023-11-07 [1] CRAN (R 4.3.1)
magrittr 2.0.3 2022-03-30 [1] CRAN (R 4.3.0)
memoise 2.0.1 2021-11-26 [1] CRAN (R 4.3.0)
mime 0.12 2021-09-28 [1] CRAN (R 4.3.0)
miniUI 0.1.1.1 2018-05-18 [1] CRAN (R 4.3.0)
P opusreader2 * 0.6.1 2023-12-23 [?] Github (spectral-cockpit/opusreader2@87a6d41)
pillar 1.9.0 2023-03-22 [1] CRAN (R 4.3.0)
pkgbuild 1.4.3 2023-12-10 [1] CRAN (R 4.3.1)
pkgconfig 2.0.3 2019-09-22 [1] CRAN (R 4.3.0)
pkgload 1.3.3 2023-09-22 [1] CRAN (R 4.3.1)
processx 3.8.3 2023-12-10 [1] CRAN (R 4.3.1)
profvis 0.3.8 2023-05-02 [1] CRAN (R 4.3.0)
promises 1.2.1 2023-08-10 [1] CRAN (R 4.3.0)
ps 1.7.5 2023-04-18 [1] CRAN (R 4.3.0)
purrr 1.0.2 2023-08-10 [1] CRAN (R 4.3.0)
R6 2.5.1 2021-08-19 [1] CRAN (R 4.3.0)
Rcpp 1.0.11 2023-07-06 [1] CRAN (R 4.3.0)
remotes * 2.4.2.1 2023-07-18 [1] CRAN (R 4.3.0)
rlang 1.1.2 2023-11-04 [1] CRAN (R 4.3.1)
rmarkdown 2.25 2023-09-18 [1] CRAN (R 4.3.1)
rprojroot 2.0.4 2023-11-05 [1] CRAN (R 4.3.1)
rstudioapi 0.15.0 2023-07-07 [1] CRAN (R 4.3.0)
sessioninfo 1.2.2 2021-12-06 [1] CRAN (R 4.3.0)
shiny 1.8.0 2023-11-17 [1] CRAN (R 4.3.1)
stringi 1.8.3 2023-12-11 [1] CRAN (R 4.3.1)
stringr 1.5.1 2023-11-14 [1] CRAN (R 4.3.1)
testthat * 3.2.1 2023-12-02 [1] CRAN (R 4.3.1)
tibble 3.2.1 2023-03-20 [1] CRAN (R 4.3.0)
urlchecker 1.0.1 2021-11-30 [1] CRAN (R 4.3.0)
usethis 2.2.2 2023-07-06 [1] CRAN (R 4.3.0)
utf8 1.2.4 2023-10-22 [1] CRAN (R 4.3.1)
vctrs 0.6.5 2023-12-01 [1] CRAN (R 4.3.1)
waldo 0.5.2 2023-11-02 [1] CRAN (R 4.3.1)
withr 2.5.2 2023-10-30 [1] CRAN (R 4.3.1)
xfun 0.41 2023-11-01 [1] CRAN (R 4.3.1)
xtable 1.8-4 2019-04-21 [1] CRAN (R 4.3.0)
yaml 2.3.8 2023-12-11 [1] CRAN (R 4.3.1)
[1] /Users/philipp/Library/R/arm64/4.3/library
[2] /Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/library
P ── Loaded and on-disk path mismatch.
─────────────────────────────────────────────────────────────────────────────────────────────────────────────
Hi @iostovary
Thanks a lot for opening getting back to us with this issue. The issue what caused by a recent commit. Unfortunately, this was an annoying mistake on my side because of bad release practice (lesson learnt). We actually have the tests in place that would have picked what you report, since v0.6.1.
To fix, I did a patch release v0.6.2. I have some further explanations what was the root cause and how I hot-fixed it in the NEWS
update of today's version bumping.
I ran the tests on the files I have, they pass. Would be great if you can reinstall the newest patch, and close this if it works.
Thanks for your understanding.
Cheers,
Philipp
Hi Isabella,
Thanks, hope you also had a good start in 2024. Good testing tomorrow.
Cheers,
Philipp