CRSU-Apps / MetaInsight

An interactive web-based tool for analyzing, interrogating, and visualizing network meta-analyses using R-shiny
https://crsu.shinyapps.io/MetaInsight/
GNU General Public License v3.0
9 stars 9 forks source link

File refactor #39

Closed JanionNevill closed 1 year ago

JanionNevill commented 1 year ago

I've extracted the libraries into a global.R file, added some explicit scoping, and refactored the download buttons file a bit.

I don't really understand the purpose of some of the library code in global, but it is exactly how it was in the original files.

I checked that everything in the app still works, but I may have missed functionality which is not immediately obvious.

JanionNevill commented 1 year ago

I've just noticed that the download buttons are no longer working. I'll investigate that immediately.

RyanJField commented 1 year ago

Hi @JanionNevill, I've been testing this on my Mac and Window, and the relative effects is not working on the windows machine this may be a package issue and nothing to do with this PR, if so i'll open a new issue.

My Mac session info:

> sessionInfo()
R version 4.3.0 (2023-04-21)
Platform: aarch64-apple-darwin20 (64-bit)
Running under: macOS Ventura 13.4

Matrix products: default
BLAS:   /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib 
LAPACK: /Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/lib/libRlapack.dylib;  LAPACK version 3.11.0

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

time zone: Europe/London
tzcode source: internal

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

other attached packages:
 [1] combinat_0.0-8        plotrix_3.8-2         tidyr_1.3.0           rmarkdown_2.21        stringr_1.5.0         shinyWidgets_0.7.6   
 [7] shinyjs_2.1.0         shinydashboard_0.7.2  shinycssloaders_1.0.0 shinyBS_0.61.1        shinyAce_0.4.2        shinyalert_3.0.0     
[13] plyr_1.8.8            plotly_4.10.1         patchwork_1.1.2       netmeta_2.8-2         meta_6.2-1            metafor_4.2-0        
[19] numDeriv_2016.8-1.1   metadat_1.2-0         Matrix_1.5-4          magick_2.7.4          ggrepel_0.9.3         ggplot2_3.4.2        
[25] ggiraphExtra_0.3.0    gemtc_1.0-1           coda_0.19-4           knitr_1.43            dplyr_1.1.2           data.table_1.14.8    
[31] cowplot_1.1.1         BUGSnet_1.1.2         shiny_1.7.4          

loaded via a namespace (and not attached):
 [1] Rdpack_2.4         gridExtra_2.3      rlang_1.1.1        magrittr_2.0.3     compiler_4.3.0     mgcv_1.8-42        systemfonts_1.0.4 
 [8] vctrs_0.6.2        reshape2_1.4.4     pkgconfig_2.0.3    fastmap_1.1.1      ellipsis_0.3.2     labeling_0.4.2     fontawesome_0.5.1 
[15] magic_1.6-1        utf8_1.2.3         promises_1.2.0.1   nloptr_2.0.3       ragg_1.2.5         purrr_1.0.1        xfun_0.39         
[22] cachem_1.0.8       jsonlite_1.8.4     later_1.3.1        sjmisc_2.8.9       uuid_1.1-0         R6_2.5.1           bslib_0.4.2       
[29] stringi_1.7.12     RColorBrewer_1.1-3 boot_1.3-28.1      rjags_4-14         jquerylib_0.1.4    Rcpp_1.0.10        httpuv_1.6.11     
[36] splines_4.3.0      igraph_1.4.3       tidyselect_1.2.0   yaml_2.3.7         rstudioapi_0.14    abind_1.4-5        sjlabelled_1.2.0  
[43] lattice_0.21-8     tibble_3.2.1       withr_2.5.0        evaluate_0.21      CompQuadForm_1.4.3 xml2_1.3.4         pillar_1.9.0      
[50] mycor_0.1.1        DT_0.28            insight_0.19.2     generics_0.1.3     mathjaxr_1.6-0     truncnorm_1.0-9    munsell_0.5.0     
[57] scales_1.2.1       minqa_1.2.5        xtable_1.8-4       glue_1.6.2         ppcor_1.1          lazyeval_0.2.2     tools_4.3.0       
[64] lme4_1.1-33        forcats_1.0.0      ggiraph_0.8.7      grid_4.3.0         crosstalk_1.2.0    rbibutils_2.2.13   colorspace_2.1-0  
[71] nlme_3.1-162       cli_3.6.1          textshaping_0.3.6  fansi_1.0.4        viridisLite_0.4.2  gtable_0.3.3       sass_0.4.6        
[78] digest_0.6.31      farver_2.1.1       htmlwidgets_1.6.2  memoise_2.0.1      htmltools_0.5.5    lifecycle_1.0.3    httr_1.4.6        
[85] mime_0.12          MASS_7.3-58.4     

My windows Session info:

> sessionInfo()
R version 4.2.0 (2022-04-22 ucrt)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19042)

Matrix products: default

locale:
[1] LC_COLLATE=English_United Kingdom.utf8  LC_CTYPE=English_United Kingdom.utf8   
[3] LC_MONETARY=English_United Kingdom.utf8 LC_NUMERIC=C                           
[5] LC_TIME=English_United Kingdom.utf8    

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

other attached packages:
 [1] combinat_0.0-8        plotrix_3.8-2         tidyr_1.3.0          
 [4] rmarkdown_2.21        stringr_1.5.0         shinyWidgets_0.7.6   
 [7] shinyjs_2.1.0         shinydashboard_0.7.2  shinycssloaders_1.0.0
[10] shinyBS_0.61.1        shinyAce_0.4.2        shinyalert_3.0.0     
[13] plyr_1.8.8            plotly_4.10.1         patchwork_1.1.2      
[16] netmeta_2.8-2         meta_6.2-1            metafor_4.2-0        
[19] numDeriv_2016.8-1.1   metadat_1.2-0         Matrix_1.4-1         
[22] magick_2.7.4          ggrepel_0.9.3         ggplot2_3.4.2        
[25] ggiraphExtra_0.3.0    gemtc_1.0-1           coda_0.19-4          
[28] knitr_1.43            dplyr_1.1.2           data.table_1.14.8    
[31] cowplot_1.1.1         BUGSnet_1.1.2         shiny_1.7.4          

loaded via a namespace (and not attached):
 [1] minqa_1.2.5        colorspace_2.1-0   ellipsis_0.3.2     sjlabelled_1.2.0  
 [5] rstudioapi_0.14    farver_2.1.1       DT_0.28            fansi_1.0.4       
 [9] mathjaxr_1.6-0     xml2_1.3.4         splines_4.2.0      cachem_1.0.7      
[13] sjmisc_2.8.9       jsonlite_1.8.4     nloptr_2.0.3       rjags_4-14        
[17] compiler_4.2.0     httr_1.4.5         fastmap_1.1.1      lazyeval_0.2.2    
[21] cli_3.6.0          later_1.3.0        htmltools_0.5.4    tools_4.2.0       
[25] igraph_1.4.3       gtable_0.3.3       glue_1.6.2         reshape2_1.4.4    
[29] Rcpp_1.0.10        jquerylib_0.1.4    vctrs_0.6.2        nlme_3.1-157      
[33] crosstalk_1.2.0    insight_0.19.1     xfun_0.39          rbibutils_2.2.13  
[37] lme4_1.1-33        mime_0.12          CompQuadForm_1.4.3 lifecycle_1.0.3   
[41] MASS_7.3-56        scales_1.2.1       ragg_1.2.5         promises_1.2.0.1  
[45] mycor_0.1.1        RColorBrewer_1.1-3 yaml_2.3.7         memoise_2.0.1     
[49] gridExtra_2.3      sass_0.4.5         stringi_1.7.12     ppcor_1.1         
[53] boot_1.3-28        truncnorm_1.0-9    Rdpack_2.4         rlang_1.1.0       
[57] pkgconfig_2.0.3    systemfonts_1.0.4  ggiraph_0.8.7      evaluate_0.21     
[61] lattice_0.20-45    fontawesome_0.5.0  purrr_1.0.1        labeling_0.4.2    
[65] htmlwidgets_1.6.2  tidyselect_1.2.0   magrittr_2.0.3     R6_2.5.1          
[69] generics_0.1.3     pillar_1.9.0       withr_2.5.0        mgcv_1.8-40       
[73] abind_1.4-5        tibble_3.2.1       uuid_1.1-0         utf8_1.2.3        
[77] grid_4.2.0         forcats_1.0.0      digest_0.6.31      xtable_1.8-4      
[81] httpuv_1.6.9       textshaping_0.3.6  munsell_0.5.0      viridisLite_0.4.2 
[85] bslib_0.4.2        magic_1.6-1     

I also get the following warnings:

Warning in left_join(pairs2, studylabs, by = "mtchvar") :
  Detected an unexpected many-to-many relationship between `x` and `y`.
ℹ Row 1 of `x` matches multiple rows in `y`.
ℹ Row 1 of `y` matches multiple rows in `x`.
ℹ If a many-to-many relationship is expected, set `relationship = "many-to-many"` to silence this warning.
Warning in left_join(pairs2, studylabs, by = "mtchvar") :
  Detected an unexpected many-to-many relationship between `x` and `y`.
ℹ Row 1 of `x` matches multiple rows in `y`.
ℹ Row 1 of `y` matches multiple rows in `x`.
ℹ If a many-to-many relationship is expected, set `relationship = "many-to-many"` to silence this warning.
Warning in left_join(pairs2, studylabs, by = "mtchvar") :
  Detected an unexpected many-to-many relationship between `x` and `y`.
ℹ Row 1 of `x` matches multiple rows in `y`.
ℹ Row 1 of `y` matches multiple rows in `x`.
ℹ If a many-to-many relationship is expected, set `relationship = "many-to-many"` to silence this warning.
Warning in left_join(pairs2, studylabs, by = "mtchvar") :
  Detected an unexpected many-to-many relationship between `x` and `y`.
ℹ Row 1 of `x` matches multiple rows in `y`.
ℹ Row 1 of `y` matches multiple rows in `x`.
ℹ If a many-to-many relationship is expected, set `relationship = "many-to-many"` to silence this warning.
Warning in write.csv(RankingData()$Probabilities %>% right_join(RankingData()$SUCRA[,  :
  attempt to set 'col.names' ignored

Once again these may not be related to the PR.

nabury commented 1 year ago

This warning is from the ranking panel and in issue #24

Warning in left_join(pairs2, studylabs, by = "mtchvar") :
  Detected an unexpected many-to-many relationship between `x` and `y`.
ℹ Row 1 of `x` matches multiple rows in `y`.
ℹ Row 1 of `y` matches multiple rows in `x`.
ℹ If a many-to-many relationship is expected, set `relationship = "many-to-many"` to silence this warning.
Warning in left_join(pairs2, studylabs, by = "mtchvar") :
  Detected an unexpected many-to-many relationship between `x` and `y`.
ℹ Row 1 of `x` matches multiple rows in `y`.
ℹ Row 1 of `y` matches multiple rows in `x`.
ℹ If a many-to-many relationship is expected, set `relationship = "many-to-many"` to silence this warning.
Warning in left_join(pairs2, studylabs, by = "mtchvar") :
  Detected an unexpected many-to-many relationship between `x` and `y`.
ℹ Row 1 of `x` matches multiple rows in `y`.
ℹ Row 1 of `y` matches multiple rows in `x`.
ℹ If a many-to-many relationship is expected, set `relationship = "many-to-many"` to silence this warning.
Warning in left_join(pairs2, studylabs, by = "mtchvar") :
  Detected an unexpected many-to-many relationship between `x` and `y`.
ℹ Row 1 of `x` matches multiple rows in `y`.
ℹ Row 1 of `y` matches multiple rows in `x`.
ℹ If a many-to-many relationship is expected, set `relationship = "many-to-many"` to silence this warning.
Warning in write.csv(RankingData()$Probabilities %>% right_join(RankingData()$SUCRA[,  :
  attempt to set 'col.names' ignored

Once again these may not be related to the PR.

nabury commented 1 year ago

Hi @JanionNevill, I've been testing this on my Mac and Window, and the relative effects is not working on the windows machine this may be a package issue and nothing to do with this PR, if so i'll open a new issue.

Is this the relative effects window of the ranking panel? There was previously an issue with the ranking panel on shiny apps.io that was down to a package update. Everything seems to be displaying properly on my Mac.

JanionNevill commented 1 year ago

The relative effects is not working on the windows machine this may be a package issue and nothing to do with this PR, if so I'll open a new issue.

Do you mean that the left-hand plot in the ranking panel does not load? I have seen that before, but next time I ran it, it appeared fine.

I've double checked on my machine and it loads fine. If that problem is as described, can you check it a second time on your windows machine please?

nabury commented 1 year ago

The relative effects is not working on the windows machine this may be a package issue and nothing to do with this PR, if so I'll open a new issue.

Do you mean that the left-hand plot in the ranking panel does not load? I have seen that before, but next time I ran it, it appeared fine.

I've double checked on my machine and it loads fine. If that problem is as described, can you check it a second time on your windows machine please?

It might also be worth asking @BalancedmonkeY about this, as it's her plot code and she fixed the previous issue we were having.

RyanJField commented 1 year ago

The relative effects is not working on the windows machine this may be a package issue and nothing to do with this PR, if so I'll open a new issue.

Do you mean that the left-hand plot in the ranking panel does not load? I have seen that before, but next time I ran it, it appeared fine.

I've double checked on my machine and it loads fine. If that problem is as described, can you check it a second time on your windows machine please?

Yes, weirdly enough it loads the second time.