title: Shiny reactivity with unused argument
body: <p>I'm new to R/Shiny, and am trying to get my head around reactivity. Both <a href="https://shiny.rstudio.com/articles/reactivity-overview.html" rel="nofollow noreferrer">this article</a> and <a href="https://www.rstudio.com/resources/videos/modularizing-shiny-app-code/" rel="nofollow noreferrer">this video</a> have been helpful resources so far, but I've bumped up against something I don't quite understand.  </p>
  
  <p>Here's a simplified version of the code I was running. </p>
  
  <pre><code>library(shiny)
  
  some_func &lt;- function(some_input, unused_argument) {
    print("Running - you changed something")
    if (some_input) {1} else {-1}
  }
  
  ui &lt;- fluidPage(
    checkboxInput("negative", "Clicking makes all values negative"),
    checkboxInput("negative_pt2", "I thought clicking would not change results
                                   other than writing to the console, 
                                   but it does not even do that."),
    plotOutput("graphs")
  )
  
  server &lt;- function(input, output) {
    library(ggplot2)
  
    output$graphs &lt;- renderPlot({
      dataset2 &lt;- reactive({mtcars * some_func(input$negative, input$negative_pt2)})
      ggplot(dataset2(), aes(x = mpg, y = hp)) + geom_line()
    })
  }
  
  shinyApp(ui = ui, server = server)
  </code></pre>
  
  <p>Checking the first box has the expected results. But viewing the console when checking the second one shows that Shiny is clever enough to realize that my unused argument is useless. This is great, but how does it know to do this?</p>
  
  <p>Thanks!</p>