reconhub / learn

RECON learn: a free, open platform for training material on epidemics analysis
https://reconlearn.org
Other
35 stars 30 forks source link

get_and_update_dependencies.R error #15

Closed thibautjombart closed 6 years ago

thibautjombart commented 6 years ago

In a vanilla session at e7261257935b67cea183b6a46f59faa9cd1f39ea

> source("R/get_and_update_dependencies.R")
── Attaching packages ─────────────────────────────────────── tidyverse 1.2.1 ──
✔ ggplot2 2.2.1     ✔ purrr   0.2.5
✔ tibble  1.4.2     ✔ dplyr   0.7.5
✔ tidyr   0.8.1     ✔ stringr 1.3.1
✔ readr   1.1.1     ✔ forcats 0.3.0
── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
✖ dplyr::filter() masks stats::filter()
✖ dplyr::lag()    masks stats::lag()
Installing packages into ‘/home/thibaut/R/x86_64-pc-linux-gnu-library/3.5’
(as ‘lib’ is unspecified)
--- Please select a CRAN mirror for use in this session ---
* Adding knitr to Imports
Next: 
Refer to functions with knitr::fun()
* Adding deSolve to Imports
Next: 
Refer to functions with deSolve::fun()
* Adding epicontacts to Imports
Next: 
Refer to functions with epicontacts::fun()
* Adding incidence to Imports
Next: 
Refer to functions with incidence::fun()
* Adding earlyR to Imports
Next: 
Refer to functions with earlyR::fun()
* Adding EpiEstim to Imports
Next: 
Refer to functions with EpiEstim::fun()
* Adding ggplot2 to Imports
Next: 
Refer to functions with ggplot2::fun()
* Adding ape to Imports
Next: 
Refer to functions with ape::fun()
* Adding outbreaks to Imports
Next: 
Refer to functions with outbreaks::fun()
* Adding epitrix to Imports
Next: 
Refer to functions with epitrix::fun()
* Adding outbreaker2 to Imports
Next: 
Refer to functions with outbreaker2::fun()
* Adding visNetwork to Imports
Next: 
Refer to functions with visNetwork::fun()
* Adding projections to Imports
Next: 
Refer to functions with projections::fun()
Error: "tidyverse" must be installed before you can take a dependency on it
In addition: Warning message:
packages ‘"tidyverse"’, ‘"openxlsx"’, ‘"pbapply"’, ‘"mvtnorm"’ are not available (for R version 3.5.0) 
stephlocke commented 6 years ago

Looks like you don't have tidyverse installed on your new R install?

stephlocke commented 6 years ago

I should also put this info in the function file

https://github.com/reconhub/learn#maintaining-package-dependencies

thibautjombart commented 6 years ago

Sorry I should have said: this is after installing and loading tidyverse:

> sessionInfo()
R version 3.5.0 (2018-04-23)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Linux Mint 18.2

Matrix products: default
BLAS: /usr/local/lib/R/lib/libRblas.so
LAPACK: /usr/local/lib/R/lib/libRlapack.so

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

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

other attached packages:
 [1] forcats_0.3.0   stringr_1.3.1   dplyr_0.7.5     purrr_0.2.5    
 [5] readr_1.1.1     tidyr_0.8.1     tibble_1.4.2    ggplot2_2.2.1  
 [9] tidyverse_1.2.1 testthat_2.0.0  knitr_1.20      devtools_1.13.5

loaded via a namespace (and not attached):
 [1] Rcpp_0.12.17     cellranger_1.1.0 pillar_1.2.3     compiler_3.5.0  
 [5] plyr_1.8.4       bindr_0.1.1      tools_3.5.0      digest_0.6.15   
 [9] lubridate_1.7.4  jsonlite_1.5     memoise_1.1.0    nlme_3.1-137    
[13] gtable_0.2.0     lattice_0.20-35  pkgconfig_2.0.1  rlang_0.2.1     
[17] psych_1.8.4      cli_1.0.0        rstudioapi_0.7   parallel_3.5.0  
[21] haven_1.1.1      bindrcpp_0.2.2   xml2_1.2.0       httr_1.3.1      
[25] withr_2.1.2      hms_0.4.2        grid_3.5.0       tidyselect_0.2.4
[29] glue_1.2.0       R6_2.2.2         readxl_1.1.0     foreign_0.8-70  
[33] modelr_0.1.2     reshape2_1.4.3   magrittr_1.5     scales_0.5.0    
[37] rvest_0.3.2      assertthat_0.2.0 mnormt_1.5-5     colorspace_1.3-2
[41] stringi_1.2.2    lazyeval_0.2.1   munsell_0.4.3    broom_0.4.4     
[45] crayon_1.3.4    
> 
thibautjombart commented 6 years ago

As of ff949f92b19d551696cea85cbd0eb165c2631aed in a R --vanilla session:

> install.packages("tidyverse")
Installing package into ‘/home/thibaut/R/x86_64-pc-linux-gnu-library/3.5’
(as ‘lib’ is unspecified)
trying URL 'https://cran.ma.imperial.ac.uk/src/contrib/tidyverse_1.2.1.tar.gz'
Content type 'application/x-gzip' length 61647 bytes (60 KB)
==================================================
downloaded 60 KB

* installing *source* package ‘tidyverse’ ...
** package ‘tidyverse’ successfully unpacked and MD5 sums checked
** R
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
*** copying figures
** building package indices
** installing vignettes
** testing if installed package can be loaded
* DONE (tidyverse)

The downloaded source packages are in
    ‘/tmp/RtmpqXXgjq/downloaded_packages’
> source("R/get_and_update_dependencies.R")
Installing packages into ‘/home/thibaut/R/x86_64-pc-linux-gnu-library/3.5’
(as ‘lib’ is unspecified)
* Adding knitr to Imports
Next: 
Refer to functions with knitr::fun()
* Adding deSolve to Imports
Next: 
Refer to functions with deSolve::fun()
* Adding epicontacts to Imports
Next: 
Refer to functions with epicontacts::fun()
* Adding incidence to Imports
Next: 
Refer to functions with incidence::fun()
* Adding earlyR to Imports
Next: 
Refer to functions with earlyR::fun()
* Adding EpiEstim to Imports
Next: 
Refer to functions with EpiEstim::fun()
* Adding ggplot2 to Imports
Next: 
Refer to functions with ggplot2::fun()
* Adding ape to Imports
Next: 
Refer to functions with ape::fun()
* Adding outbreaks to Imports
Next: 
Refer to functions with outbreaks::fun()
* Adding epitrix to Imports
Next: 
Refer to functions with epitrix::fun()
* Adding outbreaker2 to Imports
Next: 
Refer to functions with outbreaker2::fun()
* Adding visNetwork to Imports
Next: 
Refer to functions with visNetwork::fun()
* Adding projections to Imports
Next: 
Refer to functions with projections::fun()
Error: "tidyverse" must be installed before you can take a dependency on it
In addition: Warning message:
packages ‘"tidyverse"’, ‘"openxlsx"’, ‘"pbapply"’, ‘"mvtnorm"’ are not available (for R version 3.5.0) 

> sessionInfo()
R version 3.5.0 (2018-04-23)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Linux Mint 18.2

Matrix products: default
BLAS: /usr/local/lib/R/lib/libRblas.so
LAPACK: /usr/local/lib/R/lib/libRlapack.so

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

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

other attached packages:
[1] forcats_0.3.0   stringr_1.3.1   dplyr_0.7.5     purrr_0.2.5    
[5] readr_1.1.1     tidyr_0.8.1     tibble_1.4.2    ggplot2_3.0.0  
[9] tidyverse_1.2.1

loaded via a namespace (and not attached):
 [1] Rcpp_0.12.17     cellranger_1.1.0 pillar_1.2.3     compiler_3.5.0  
 [5] plyr_1.8.4       bindr_0.1.1      tools_3.5.0      digest_0.6.15   
 [9] memoise_1.1.0    lubridate_1.7.4  jsonlite_1.5     nlme_3.1-137    
[13] gtable_0.2.0     lattice_0.20-35  pkgconfig_2.0.1  rlang_0.2.1     
[17] psych_1.8.4      cli_1.0.0        rstudioapi_0.7   parallel_3.5.0  
[21] haven_1.1.1      bindrcpp_0.2.2   withr_2.1.2      xml2_1.2.0      
[25] httr_1.3.1       devtools_1.13.6  hms_0.4.2        grid_3.5.0      
[29] tidyselect_0.2.4 glue_1.2.0       R6_2.2.2         tcltk_3.5.0     
[33] readxl_1.1.0     foreign_0.8-70   modelr_0.1.2     reshape2_1.4.3  
[37] magrittr_1.5     scales_0.5.0     rvest_0.3.2      assertthat_0.2.0
[41] mnormt_1.5-5     colorspace_1.3-2 stringi_1.2.3    lazyeval_0.2.1  
[45] munsell_0.5.0    broom_0.4.4      crayon_1.3.4    
> 
stephlocke commented 6 years ago

I've improved this with the use of the automagic package instead of handwritten code. https://github.com/lockedata/learn#referencing-packages

thibautjombart commented 6 years ago

The error was coming from the processing of package names, some of which were containing \". Fixed via 829abbfb2c4b8021c4553bd8f21c2e4ed8617ef6

stephlocke commented 6 years ago

I encountered this with automagic - I didn't realise I was os oldschool when I'd do library("tidyverse") :joy:

I changed the referencing in the individual files, we're working on a PR for automagic to handle these cases better, and I added guidance in to the README.