library(dplyr)
library(shiny)
shinyApp(
ui = basicPage(
mainPanel(
numericInput("model_input", label = h5("Total Budget"), value = 9000000),
numericInput("iterations", label = h5("Iterations"), value = 900),
actionButton("run", "Run"),
actionButton("reset", "reset"),
tableOutput("view")
)
),
server = function(input, output) {
v <- reactiveValues(data = mtcars) # this makes sure that on load, your default data will show up
observeEvent(input$run, {
v$data <- mtcars %>% mutate(new = mpg * input$model_input +input$iterations)
})
observeEvent(input$reset, {
v$data <- mtcars # your default data
})
output$view <- renderTable({
v$data
})
}
)