Skip to content
Permalink
main
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
message("* Loading libraries *")
suppressMessages(library(magrittr))
suppressMessages(library(tidyverse))
suppressMessages(library(shiny))
suppressMessages(library(shinythemes))
suppressMessages(library(foreach))
suppressMessages(library(openxlsx))
suppressMessages(library(gplots))
suppressMessages(library(enviPat))
suppressMessages(library(RColorBrewer))
suppressMessages(library(DT))
options(shiny.maxRequestSize=100*1024^2)
dir1 <- "Scripts"
message("* Loading scripts *")
for (f in list.files(dir1, pattern = "\\.R$")) {
source(file.path(dir1, f))
}
if (Sys.info()["user"] == "cedlich") {
assign("DEBUG", TRUE, env = .GlobalEnv)
} else {
assign("DEBUG", FALSE, env = .GlobalEnv)
}
message("* Assigning global variables *")
assign("MY_SHINY_PREFERENCES",
if(file.exists("shiny_preferences.RDS")) my_read_shiny_prefs() else list(),
envir = .GlobalEnv
)
# data("isotopes")
assign("colours1", colours() %>% keep(!grepl("^gr[ea]y", .) & !grepl("[0-9]$", .)) %>% sort(), envir = .GlobalEnv)
message("* Starting shiny *")
#### ui ####
ui <-
fluidPage(
navbarPage(
title = "Shiny Filter",
tabPanel("Infile", source(file.path("ui_code", "0100_ui_infile.R"), local = TRUE)$value),
tabPanel("Filter", source(file.path("ui_code", "0200_ui_filter.R"), local = TRUE)$value),
tabPanel("Outfile", source(file.path("ui_code", "0300_ui_outfile.R"), local = TRUE)$value)
)
)
server <- function(input, output, session) {
my_raw_data <- reactiveValues()
my_pca <- reactiveValues()
my_plot <- reactiveValues()
my_filter <- reactiveValues()
source(file.path("server_code", "0100_server_infile.R"), local = TRUE)$value
source(file.path("server_code", "0200_server_filter.R"), local = TRUE)$value
source(file.path("server_code", "0300_server_outfile.R"), local = TRUE)$value
onStop(function() {
env = parent.env(environment())
ls(envir = env) %>%
## .. excluding e.g. session" and "output"
setdiff(c("session", "output", "my_pref_update")) %>%
## object in a list
mget(envir = env) %>%
## keep only reactive values
subset(., subset = sapply(., is.reactivevalues)) %>%
## convert reactive values
sapply(function(z) isolate(reactiveValuesToList(z)), simplify=F) %>%
## assign to global environment
list2env(envir = .GlobalEnv)
cat("Session stopped\n")
cat("Type `save(list=ls(), file='tmp.RData')` to save state variables in your current working directory\n")
cat("Find out what current working directory by typing `getwd()`\n")
})
}
shinyApp(ui, server)