DOI-USGS / streamMetabolizer

streamMetabolizer uses inverse modeling to estimate aquatic metabolism (photosynthesis and respiration) from time series data on dissolved oxygen, water temperature, depth, and light.
http://usgs-r.github.io/streamMetabolizer/
Other
37 stars 22 forks source link

Error in c(x, sep = "\r") : could not find symbol "recursive" in environment of the generic function #337

Closed mluerig closed 7 years ago

mluerig commented 7 years ago

Trying to generate some test data gives me an error (R v.3.3.3)

dat <- data_metab(num_days='3', res='15', day_start=4, day_end=28, attach.units=TRUE) Error in c(x, sep = "\r") : could not find symbol "recursive" in environment of the generic function

aappling-usgs commented 7 years ago

Thanks. Could you share the output of sessionInfo()?

mluerig commented 7 years ago
> sessionInfo()
R version 3.3.3 (2017-03-06)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)

locale:
[1] LC_COLLATE=German_Germany.1252  LC_CTYPE=German_Germany.1252    LC_MONETARY=German_Germany.1252 LC_NUMERIC=C                   
[5] LC_TIME=German_Germany.1252    

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

other attached packages:
 [1] StreamMetabolism_1.1.2   maptools_0.9-2           sp_1.2-4                 chron_2.3-50             zoo_1.7-14              
 [6] streamMetabolizer_0.9.33 survival_2.41-3          tidyr_0.6.1              cowplot_0.7.0            lmerTest_2.0-33         
[11] lme4_1.1-12              Matrix_1.2-8             reshape_0.8.6            scales_0.4.1             lubridate_1.6.0         
[16] RColorBrewer_1.1-2       dplyr_0.5.0              plyr_1.8.4               gridExtra_2.2.1          ggplot2_2.2.1           
[21] moments_0.14            

loaded via a namespace (and not attached):
 [1] Rcpp_0.12.10          lattice_0.20-34       assertthat_0.1        digest_0.6.12         R6_2.2.0              backports_1.0.5      
 [7] acepack_1.4.1         httr_1.2.1            LakeMetabolizer_1.5.0 lazyeval_0.2.0        minqa_1.2.4           data.table_1.10.4    
[13] nloptr_1.0.4          rpart_4.1-10          checkmate_1.8.2       labeling_0.3          devtools_1.12.0       splines_3.3.3        
[19] rLakeAnalyzer_1.8.3   stringr_1.2.0         foreign_0.8-67        htmlwidgets_0.8       RCurl_1.95-4.8        munsell_0.4.3        
[25] base64enc_0.1-3       htmltools_0.3.5       nnet_7.3-12           unitted_0.2.7         tibble_1.3.0          htmlTable_1.9        
[31] Hmisc_4.0-2           XML_3.98-1.6          withr_1.0.2           MASS_7.3-45           bitops_1.0-6          nlme_3.1-131         
[37] gtable_0.2.0          DBI_0.6-1             magrittr_1.5          stringi_1.1.5         latticeExtra_0.6-28   Formula_1.2-1        
[43] deSolve_1.14          tools_3.3.3           parallel_3.3.3        colorspace_1.3-2      cluster_2.0.5         memoise_1.0.0        
[49] knitr_1.15.1    
aappling-usgs commented 7 years ago

Great. I know I fixed this recently, but can't find the specific commit. I think the conflict arose with the update to R 3.3.3. Please try

devtools::install_github('USGS-R/streamMetabolizer@v0.10.0')

which should get you

> packageVersion('streamMetabolizer')
[1] ‘0.10.0’

and then try

dat <- data_metab(num_days='3', res='15', day_start=4, day_end=28, attach.units=TRUE)

again.

mluerig commented 7 years ago

I updated to 0.10.0, still gives me the same error

aappling-usgs commented 7 years ago

Shoot. Maybe also try

devtools::install_github('appling/unitted')

If that doesn't do it, could you share the output of a call to traceback() right after the data_metab() call?

dat <- data_metab(num_days='3', res='15', day_start=4, day_end=28, attach.units=TRUE)
traceback()
mluerig commented 7 years ago

that did it - thanks!

aappling-usgs commented 7 years ago

Thanks! I'll update the dependency requirements so others are less likely to encounter this problem.

jakehosen commented 7 years ago

I'm having this problem using streamMetabolizer 0.10.1 and R 3.3.3 on macOS 10.12.5. I tried installing unitted, but was not able to resolve the error.

aappling-usgs commented 7 years ago

Hmm, thanks for letting me know. Could you share the output of these calls?

library(streamMetabolizer)
devtools::session_info()
dat <- data_metab(num_days='3', res='15', day_start=4, day_end=28, attach.units=TRUE)
traceback()
jakehosen commented 7 years ago

session_info() `Session info ------------------------------------------------------------------------------------------------------------- setting value
version R version 3.3.3 (2017-03-06) system x86_64, mingw32
ui RStudio (1.0.136)
language (EN)
collate English_United States.1252
tz America/New_York
date 2017-07-18

Packages ----------------------------------------------------------------------------------------------------------------- package version date source
assertthat 0.1 2013-12-06 CRAN (R 3.3.3)
colorspace 1.3-2 2016-12-14 CRAN (R 3.3.3)
curl 2.3 2016-11-24 CRAN (R 3.3.3)
DBI 0.6 2017-03-09 CRAN (R 3.3.3)
deSolve 1.14 2016-09-05 CRAN (R 3.3.2)
devtools
1.12.0 2016-06-24 CRAN (R 3.3.3)
digest 0.6.12 2017-01-27 CRAN (R 3.3.3)
dplyr 0.5.0 2016-06-24 CRAN (R 3.3.3)
ggplot2
2.2.1 2016-12-30 CRAN (R 3.3.3)
gtable 0.2.0 2016-02-26 CRAN (R 3.3.3)
httr 1.2.1 2016-07-03 CRAN (R 3.3.3)
jsonlite 1.3 2017-02-28 CRAN (R 3.3.3)
LakeMetabolizer 1.5.0 2016-06-23 CRAN (R 3.3.3)
lazyeval 0.2.0 2016-06-12 CRAN (R 3.3.3)
lubridate 1.6.0 2016-09-13 CRAN (R 3.3.3)
magrittr 1.5 2014-11-22 CRAN (R 3.3.3)
memoise 1.0.0 2016-01-29 CRAN (R 3.3.3)
munsell 0.4.3 2016-02-13 CRAN (R 3.3.3)
plyr 1.8.4 2016-06-08 CRAN (R 3.3.3)
R6 2.2.0 2016-10-05 CRAN (R 3.3.3)
Rcpp 0.12.9 2017-01-14 CRAN (R 3.3.3)
rLakeAnalyzer 1.8.3 2016-05-21 CRAN (R 3.3.3)
scales 0.4.1 2016-11-09 CRAN (R 3.3.3)
streamMetabolizer 0.10.0 2017-03-20 Github (USGS-R/streamMetabolizer@ccdfbe6) stringi 1.1.2 2016-10-01 CRAN (R 3.3.2)
stringr 1.2.0 2017-02-18 CRAN (R 3.3.3)
tibble 1.2 2016-08-26 CRAN (R 3.3.3)
tidyr
0.6.1 2017-01-10 CRAN (R 3.3.3)
unitted 0.2.7 2017-01-17 local
withr 1.0.2 2016-06-20 CRAN (R 3.3.3) `

traceback() 13: c(x, sep = "\r") 12: do.call("paste", c(x, sep = "\r")) 11: duplicated(do.call("paste", c(x, sep = "\r")), fromLast = fromLast) 10: duplicated.data.frame(x, fromLast = fromLast, ...) 9: duplicated(x, fromLast = fromLast, ...) 8: [.data.frame(x, !duplicated(x, fromLast = fromLast, ...), , drop = FALSE) 7: NextMethod("[") 6: [.unitted(x, !duplicated(x, fromLast = fromLast, ...), , drop = FALSE) 5: x[!duplicated(x, fromLast = fromLast, ...), , drop = FALSE] 4: unique.data.frame(french[!is.na(french$oxy), ]) 3: unique(french[!is.na(french$oxy), ]) 2: load_french_creek(attach.units = attach.units) 1: data_metab(num_days = "3", res = "15", day_start = 4, day_end = 28, attach.units = TRUE)

jakehosen commented 7 years ago

Interestingly, once I rebooted my Mac the problem went away (and the version of unitted reported by session_info() now matches the version from github). The problem exists on my windows machine as well and when I tried to install the new version of unitted with devtools I got the following error:

ERROR: dependency 'tibble' is not available for package 'unitted'

Both of these machines have had multiple older versions of streammetabolizer installed on the same R install. Is it possible that I am getting these problems when others aren't because I haven't done a clean install in a while?

aappling-usgs commented 7 years ago

Interesting that rebooting did it. Restarting R/RStudio is often useful, but I haven't seen that many cases where a full reboot was necessary. Anyway, glad the Mac is working.

For the Windows machine, looks like it would help to run install.packages('tibble') before trying to install unitted. If you see similar ERRORs with different package names after that, try installing those too. And then let me know how it went.

jakehosen commented 7 years ago

I did as you said and now i get a different error when installing unitted (see below). I should note that this isn't a particularly big problem for me, the only time I have ever had a problem is when trying to access the example data, but I did want to give you the heads up that I'm having this problem.

devtools::install_github('appling/unitted') Downloading GitHub repo appling/unitted@master from URL https://api.github.com/repos/appling/unitted/zipball/master Installing unitted "C:/PROGRA~1/R/R-33~1.3/bin/x64/R" --no-site-file --no-environ --no-save --no-restore --quiet CMD INSTALL \ "C:/Users/prime/AppData/Local/Temp/RtmpSQLJHh/devtools4c4233513cf/appling-unitted-ee67125" \ --library="C:/Users/prime/Documents/R/win-library/3.3" --install-tests

jakehosen commented 7 years ago

The newer problem was caused by an incompatibility between R 3.3.3 and the newest version of dplyr, which was installed when I updated unitted. I hadn't updated R recently because backend changes on the Mac side have caused performance issues with version 3.4.x. Updating to R 3.4.1 has resolved all the issues.

aappling-usgs commented 7 years ago

Oi, so complicated! Good work, and thanks for the update.