Search code examples
rshiny-servershiny

Check if Shiny app works correctly


I started to work with shiny. I wonder what a simple way is to reproduce the outcome which is not visualized and displayed in the app. Meaning, the stuff which runs in the background. Something like print when writing and debugging a little script.

So, I assigned a variable test <- as.integer(1) in the server.R file. When I open the console in Firefox and I want to print out my variable test it says its not defined. Am I doing something wrong with checking weather the variable is assigned or did I do something wrong during the assigning process?!


Solution

  • No, not something like this

     test <- reactive({
          input$bounds 
          print(bounds)
      })
    

    Rather something like:

     test <- reactive ({
           print(input$bounds)
     )}
    

    or

     test <- reactive ({
          input$bounds
     )}
     observe ({
          print(test())
     )}