Hi all,
I would like to build an app which takes parameters from the UI and, when the user click on a button, the server executes a homemade function. Finally, i have to plot the results.
I do not need the reactive function since I want to use the server side as a computation machine.
I tried to do such app based on the tutorial of Shiny but the problem is that the computation in my function begins immediately, even before I clicked on the submitButton.
I do not know how to wait that the button is clicked to execute myFunction.
######UI.R code :
library(shiny)
library(shinyIncubator)
# Define UI for miles per gallon application
shinyUI(pageWithSidebar(
# Application title
headerPanel("perTurbo Classification"),
# Sidebar with controls to select the variable to plot against mpg
# and to specify whether outliers should be included
sidebarPanel(
selectInput("dataset", "Choose a dataset:",
choices = c("at_chloro", "tan2009r1", "dunkley2006")),
submitButton("Execute"),
),
# Show the caption and plot of the requested variable against mpg
# Show a tabset that includes a plot, summary, and table view
# of the generated distribution
mainPanel(
tabsetPanel(
tabPanel("Plot", plotOutput("plot"))
)
)
))
###### server.R code
# Define server logic required to plot various variables against mpg
shinyServer(function(input, output) {
#
paramInput <- function() {
list("dataset" = input$dataset )
}
output$plot <- reactivePlot(function() {
theDataSet <- datasetInput()
foo <- myFunction(theDataset)
plot(foo)
})
})
Thanks for your help
Sam