Display output table in shiny based on user inputs and reset to default table

I have a shiny app which on load I want to show a default table. Now once the application is loaded the user can change the values in the inputs and once clicked on the run button it the current table should be replaced with the new table based on user inputs. And once done and if the user clicks on the reset button it should again show the default table. How can I achieve that. Below is the bas app

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) {
  runcar<- reactive({
    mtcars %>% mutate(new = mpg * input$model_input +input$iterations)
         })
  output$view <- renderTable({
    mtcars
  })
}

)

This topic was automatically closed 54 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.