|
1 | | -################################################################################ |
2 | | -# global.R |
3 | | -# This R Script declares the required packages for loading the Shiny App, links |
4 | | -# other R Scripts with global objects and defines global variables and functions. |
5 | | -################################################################################ |
6 | | - |
7 | | -### Declaration of required packages for running the Shiny App smoothly -------- |
8 | | -library(shiny) # version: 1.4.0 |
9 | | -library(shinyjs) # version: 1.1 |
10 | | -library(data.table) # version: 1.12.8 |
11 | | -library(DT) # version: 0.12 |
12 | | -library(ggplot2) # version: 3.2.1 |
13 | | -library(plotly) # version: 4.9.1 |
14 | | -library(scales) # version: 1.1.0 |
15 | | -library(shinycssloaders) # version: 0.3 |
16 | | -library(conflicted) # version: 1.0.4 |
17 | | -library(dplyr) # version: 0.8.3 |
18 | | -library(tidyr) # version: 1.0.2 |
19 | | -library(survival) # version: 3.1-8 |
20 | | -library(survminer) # version: 0.4.6 |
21 | | -library(fmsb) # version: 0.7.0 |
22 | | - |
23 | | -conflict_prefer("first", "dplyr") |
24 | | -conflict_prefer("filter", "dplyr") |
25 | | -# conflict_prefer("layout", "plotly") |
26 | | -# conflict_prefer("hidden", "shinyjs") |
27 | | -# conflict_prefer("dataTableOutput", "DT") |
28 | | - |
29 | | - |
30 | | -### Source any R Scripts other than ui.R, server.R and global.R ---------------- |
31 | | -source("volcano_plot.R") |
32 | | -source("GetStatistics.R") |
33 | | - |
34 | | - |
35 | | -### Definitions of global variables and functions ------------------------------ |
36 | | -# Check that it doesn't match any non-number |
37 | | -numbers_only <- function(x) !grepl("\\D", x) |
38 | | - |
39 | | -fmt_dcimals <- function(decimals = 0) { |
40 | | - function(x) format(x, nsmall = decimals, scientific = FALSE) |
41 | | -} |
42 | | - |
43 | | -reverselog_trans <- function(base = exp(1)) { |
44 | | - trans <- function(x) -log(x, base) |
45 | | - inv <- function(x) base^(-x) |
46 | | - trans_new(paste0("reverselog-", format(base)), trans, inv, |
47 | | - log_breaks(base = base), |
48 | | - domain = c(1e-100, Inf)) |
49 | | -} |
50 | | - |
51 | | - |
| 1 | +################################################################################ |
| 2 | +# global.R |
| 3 | +# This R Script declares the required packages for loading the Shiny App, links |
| 4 | +# other R Scripts with global objects and defines global variables and functions. |
| 5 | +################################################################################ |
| 6 | + |
| 7 | +### Declaration of required packages for running the Shiny App smoothly -------- |
| 8 | +library(shiny) # version: 1.4.0 |
| 9 | +library(shinyjs) # version: 1.1 |
| 10 | +library(data.table) # version: 1.12.8 |
| 11 | +library(DT) # version: 0.12 |
| 12 | +library(ggplot2) # version: 3.2.1 |
| 13 | +library(plotly) # version: 4.9.1 |
| 14 | +library(scales) # version: 1.1.0 |
| 15 | +library(shinycssloaders) # version: 0.3 |
| 16 | +library(conflicted) # version: 1.0.4 |
| 17 | +library(dplyr) # version: 0.8.3 |
| 18 | +library(tidyr) # version: 1.0.2 |
| 19 | +library(survival) # version: 3.1-8 |
| 20 | +library(survminer) # version: 0.4.6 |
| 21 | +library(fmsb) # version: 0.7.0 |
| 22 | +library(shinyWidgets) |
| 23 | +library(cowplot) |
| 24 | +# if function conflicts, default dplyr |
| 25 | +conflict_prefer("first", "dplyr") |
| 26 | +select <- dplyr::select; rename <- dplyr::rename; mutate <- dplyr::mutate; summarize <- dplyr::summarize; arrange <- dplyr::arrange; slice <- dplyr::slice; filter <- dplyr::filter; recode<-dplyr::recode |
| 27 | +style <- plotly::style |
| 28 | +# conflict_prefer("layout", "plotly") |
| 29 | +# conflict_prefer("hidden", "shinyjs") |
| 30 | +# conflict_prefer("dataTableOutput", "DT") |
| 31 | + |
| 32 | + |
| 33 | +### Source any R Scripts other than ui.R, server.R and global.R ---------------- |
| 34 | +source("volcano_plot.R") |
| 35 | +source("GetStatistics.R") |
| 36 | + |
| 37 | + |
| 38 | +### Definitions of global variables and functions ------------------------------ |
| 39 | +# Check that it doesn't match any non-number |
| 40 | +numbers_only <- function(x) !grepl("\\D", x) |
| 41 | + |
| 42 | +# fmt_dcimals <- function(decimals = 0) { |
| 43 | +# function(x) format(x, nsmall = decimals, scientific = FALSE) |
| 44 | +# } |
| 45 | + |
| 46 | +reverselog_trans <- function(base = exp(1)) { |
| 47 | + trans <- function(x) -log(x, base) |
| 48 | + inv <- function(x) base^(-x) |
| 49 | + trans_new(paste0("reverselog-", format(base)), trans, inv, |
| 50 | + log_breaks(base = base), |
| 51 | + domain = c(1e-100, Inf)) |
| 52 | +} |
| 53 | + |
0 commit comments