-
-
Save vfulco/1fbd88b5abc8bfffa7d5f6483341bbba to your computer and use it in GitHub Desktop.
Revisions
-
vpnagraj created this gist
Nov 17, 2016 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,59 @@ library(shiny) options(shiny.reactlog=TRUE) # define home dir for shiny app homed <- getwd() # set up choices to be retrievable in server.R progchoices <- c("This is a TEST APP" = "testapp/", "Yet Another Program" = "anotherprog/") ui <- fluidPage( titlePanel("CODA Bioinformatics App Launcher"), sidebarLayout( sidebarPanel( radioButtons(inputId = "app", label = "Select an application to run:", choices = progchoices), actionButton("goButton", "Run") ), mainPanel( h3(textOutput("message")) ) ) ) server <- function(input, output) { runandmessage <- eventReactive(input$goButton, ({ # set working dir setwd(input$app) # browser() # find file to run filelist <- list.files() filetorun <- grep(pattern = "RUN", filelist, value = T) # run it source(filetorun) # return to shiny app home dir defined above setwd(homed) # construct message # get the name of the program that was selected to run progname <- names(progchoices[progchoices==input$app]) # output message paste0(progname, " successfully ran!") }) ) output$message <- renderText ({ # execute reactive expression defined above runandmessage() }) } shinyApp(ui = ui, server = server)