Advertisement
Guest User

Untitled

a guest
Feb 19th, 2017
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.18 KB | None | 0 0
  1. library(shiny)
  2.  
  3. ui <- fluidPage(
  4.  
  5. titlePanel("PLOP"),
  6.  
  7. sidebarLayout(
  8. sidebarPanel(
  9. selectInput("variable", "Variable:",
  10. c("Cylinders" = "cyl",
  11. "Transmission" = "am",
  12. "Gears" = "gear")),
  13. actionButton("press","press")
  14. ),
  15.  
  16. mainPanel(
  17. textOutput("text")
  18. )
  19. )
  20. )
  21.  
  22. server <- function(input, output) {
  23.  
  24. output$text <- renderText({
  25. input$press
  26. message("rendertext at ",Sys.time())
  27. paste(input$variable,Sys.time())})
  28.  
  29. observeEvent(input$variable,
  30. message("variable is edited at ",Sys.time())
  31. )
  32. observeEvent(input$press,{
  33. message("button is presed at ",Sys.time())
  34. # lot of stuff
  35. Sys.sleep(2)
  36. message("end calculation at ",Sys.time())
  37. # AND NOW I would like to send a "false" input$variable update
  38. # I dont want to change input$variable, but I need to rerun everything which use input$variable
  39. # ( .... ) for example : changing output$text but AFTER the Sys.sleep call
  40.  
  41.  
  42. })
  43.  
  44.  
  45.  
  46.  
  47. }
  48.  
  49. # Run the application
  50. shinyApp(ui = ui, server = server)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement