DOI-USGS/streamMetabolizer

Incompatibility new release R 4.1.0

Closed this issue · 6 comments

I recently upgraded from R 4.0.3 to the new (May 2021) release R 4.1.0
and the streamMetabolizer package is not functioning any more.

I think because of a change in the exists() function that requires argument of length 1

In older R release, it was not checked (even if only the 1st element was considered)
in the new R release it is checked
and the function is called with argument of length 3 is called in several functions of metab.
exists(c('date',"warnings','errors"), fit)

Below the code and console output

library(streamMetabolizer)
library(dplyr)
dat <- data_metab(num_days='3', res='15', day_start=4, day_end=28, attach.units=TRUE)
classic_specs <- specs( mm_name('mle', GPP_fun='linlight', ER_fun='constant') )

(I here get the classical dplyr deprecated messages)

mm_classic <- streamMetabolizer::metab(classic_specs, data=dat)
Erreur dans exists(c("date", "warnings", "errors"), fit) :
first argument is of length > 1

devtools::session_info()

 setting  value                       
 version  R version 4.1.0 (2021-05-18)
 os       Ubuntu 18.04.5 LTS          
 system   x86_64, linux-gnu           
 ui       RStudio                     
 language fr_FR                       
 collate  fr_FR.UTF-8                 
 ctype    fr_FR.UTF-8                 
 tz       Europe/Paris                
 date     2021-06-23                  

─ Packages ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
 package           * version  date       lib source                                   
 assertthat          0.2.1    2019-03-21 [1] CRAN (R 4.1.0)                           
 cachem              1.0.5    2021-05-15 [1] CRAN (R 4.1.0)                           
 callr               3.7.0    2021-04-20 [1] CRAN (R 4.1.0)                           
 cli                 2.5.0    2021-04-26 [1] CRAN (R 4.1.0)                           
 codetools           0.2-18   2020-11-04 [4] CRAN (R 4.0.3)                           
 colorspace          2.0-1    2021-05-04 [1] CRAN (R 4.1.0)                           
 crayon              1.4.1    2021-02-08 [1] CRAN (R 4.1.0)                           
 curl                4.3.1    2021-04-30 [1] CRAN (R 4.1.0)                           
 data.table          1.14.0   2021-02-21 [1] CRAN (R 4.1.0)                           
 DBI                 1.1.1    2021-01-15 [1] CRAN (R 4.1.0)                           
 desc                1.3.0    2021-03-05 [1] CRAN (R 4.1.0)                           
 deSolve             1.28     2020-03-08 [1] CRAN (R 4.1.0)                           
 devtools            2.4.2    2021-06-07 [1] CRAN (R 4.1.0)                           
 digest              0.6.27   2020-10-24 [1] CRAN (R 4.1.0)                           
 dplyr             * 1.0.6    2021-05-05 [1] CRAN (R 4.1.0)                           
 ellipsis            0.3.2    2021-04-29 [1] CRAN (R 4.1.0)                           
 fansi               0.5.0    2021-05-25 [1] CRAN (R 4.1.0)                           
 fastmap             1.1.0    2021-01-25 [1] CRAN (R 4.1.0)                           
 fs                  1.5.0    2020-07-31 [1] CRAN (R 4.1.0)                           
 generics            0.1.0    2020-10-31 [1] CRAN (R 4.1.0)                           
 ggplot2           * 3.3.4    2021-06-16 [1] CRAN (R 4.1.0)                           
 glue                1.4.2    2020-08-27 [1] CRAN (R 4.1.0)                           
 gridExtra           2.3      2017-09-09 [1] CRAN (R 4.1.0)                           
 gtable              0.3.0    2019-03-25 [1] CRAN (R 4.1.0)                           
 htmltools           0.5.1.1  2021-01-22 [1] CRAN (R 4.1.0)                           
 htmlwidgets         1.5.3    2020-12-10 [1] CRAN (R 4.1.0)                           
 httr                1.4.2    2020-07-20 [1] CRAN (R 4.1.0)                           
 hydrogeo          * 0.6-1    2017-03-12 [1] CRAN (R 4.1.0)                           
 inline              0.3.19   2021-05-31 [1] CRAN (R 4.1.0)                           
 jsonlite            1.7.2    2020-12-09 [1] CRAN (R 4.1.0)                           
 LakeMetabolizer     1.5.3    2021-05-25 [1] Github (GLEON/LakeMetabolizer@5e42781)   
 lazyeval            0.2.2    2019-03-15 [1] CRAN (R 4.1.0)                           
 lifecycle           1.0.0    2021-02-15 [1] CRAN (R 4.1.0)                           
 loo                 2.4.1    2020-12-09 [1] CRAN (R 4.1.0)                           
 lubridate           1.7.10   2021-02-26 [1] CRAN (R 4.1.0)                           
 magrittr            2.0.1    2020-11-17 [1] CRAN (R 4.1.0)                           
 matrixStats         0.59.0   2021-06-01 [1] CRAN (R 4.1.0)                           
 memoise             2.0.0    2021-01-26 [1] CRAN (R 4.1.0)                           
 misc3d              0.9-0    2020-09-06 [1] CRAN (R 4.1.0)                           
 munsell             0.5.0    2018-06-12 [1] CRAN (R 4.1.0)                           
 openxlsx          * 4.2.4    2021-06-16 [1] CRAN (R 4.1.0)                           
 pillar              1.6.1    2021-05-16 [1] CRAN (R 4.1.0)                           
 pkgbuild            1.2.0    2020-12-15 [1] CRAN (R 4.1.0)                           
 pkgconfig           2.0.3    2019-09-22 [1] CRAN (R 4.1.0)                           
 pkgload             1.2.1    2021-04-06 [1] CRAN (R 4.1.0)                           
 plotly            * 4.9.4    2021-06-08 [1] CRAN (R 4.1.0)                           
 plyr                1.8.6    2020-03-03 [1] CRAN (R 4.1.0)                           
 prettyunits         1.1.1    2020-01-24 [1] CRAN (R 4.1.0)                           
 processx            3.5.2    2021-04-30 [1] CRAN (R 4.1.0)                           
 ps                  1.6.0    2021-02-28 [1] CRAN (R 4.1.0)                           
 ptinpoly            2.8      2020-06-02 [1] CRAN (R 4.1.0)                           
 purrr               0.3.4    2020-04-17 [1] CRAN (R 4.1.0)                           
 R6                  2.5.0    2020-10-28 [1] CRAN (R 4.1.0)                           
 Rcpp                1.0.6    2021-01-15 [1] CRAN (R 4.1.0)                           
 RcppParallel        5.1.4    2021-05-04 [1] CRAN (R 4.1.0)                           
 remotes             2.4.0    2021-06-02 [1] CRAN (R 4.1.0)                           
 rLakeAnalyzer       1.11.4.1 2019-06-09 [1] CRAN (R 4.1.0)                           
 rlang               0.4.11   2021-04-30 [1] CRAN (R 4.1.0)                           
 rprojroot           2.0.2    2020-11-15 [1] CRAN (R 4.1.0)                           
 rstan               2.21.2   2020-07-27 [1] CRAN (R 4.1.0)                           
 rstudioapi          0.13     2020-11-12 [1] CRAN (R 4.1.0)                           
 scales              1.1.1    2020-05-11 [1] CRAN (R 4.1.0)                           
 sessioninfo         1.1.1    2018-11-05 [1] CRAN (R 4.1.0)                           
 StanHeaders         2.21.0-7 2020-12-17 [1] CRAN (R 4.1.0)                           
 streamMetabolizer * 0.11.4   2021-05-25 [1] Github (USGS-R/streamMetabolizer@4a7ba9c)
 stringi             1.6.2    2021-05-17 [1] CRAN (R 4.1.0)                           
 testthat            3.0.2    2021-02-14 [1] CRAN (R 4.1.0)                           
 tibble              3.1.2    2021-05-16 [1] CRAN (R 4.1.0)                           
 tidyr               1.1.3    2021-03-03 [1] CRAN (R 4.1.0)                           
 tidyselect          1.1.1    2021-04-30 [1] CRAN (R 4.1.0)                           
 unitted             0.2.9    2021-05-25 [1] Github (appling/unitted@d1f1172)         
 usethis             2.0.1    2021-02-10 [1] CRAN (R 4.1.0)                           
 utf8                1.2.1    2021-03-12 [1] CRAN (R 4.1.0)                           
 V8                  3.4.2    2021-05-01 [1] CRAN (R 4.1.0)                           
 vctrs               0.3.8    2021-04-29 [1] CRAN (R 4.1.0)                           
 viridisLite         0.4.0    2021-04-13 [1] CRAN (R 4.1.0)                           
 withr               2.4.2    2021-04-18 [1] CRAN (R 4.1.0)                           
 zip                 2.2.0    2021-05-31 [1] CRAN (R 4.1.0)                           

[1] /home/sguillon/R/x86_64-pc-linux-gnu-library/4.1
[2] /usr/local/lib/R/site-library
[3] /usr/lib/R/site-library
[4] /usr/lib/R/library

Thanks! Should be fixed with version 0.12.0 - please let me know if you still have trouble.

Many thanks for the new version.
I don't get the error any more, metab calculations (classic MLE and bayesian) run ok.
But I now have trouble with all the "plot" commands (plot_metab_preds(), plot_DO_preds())
They systematically lead to "R session abort".

Hi Sophie, thanks for the feedback. So far I'm unable to replicate the issues you're reporting for the plot commands - could you share a code script for which it's breaking?

Hi Alison,
My issue is when I want to do
plot_DO_preds(mm_classic)
(the last command in the Quickstart for the package, using the 3 days dataset
I get no error message in the terminal, but a windows opens "R session aborted". See attached screenshot
screenshot_Rstudio

But I don't have any problem when I use R in a terminal (I am running on Linux) instead of Rstudio.
So I guess I will have to fix somehow my Rstudio...

Hi again,
My apologies , I updated Rstudio to the latest version and everything is working fine now.
I close the comment and thank you very much for the the update of the package.

Great, glad you found a solution, and thanks for following up!