title: How to return input values from callModule function in shiny
body: <p>I am currently trying to modularize my shiny app based on <a href="http://shiny.rstudio.com/articles/modules.html" rel="noreferrer" title="this tutorial">this tutorial</a>. In my actual app, I have two <code>selectInput</code> that allow the user to select the first and the last quarter-end date, based on which some statistics for some data set are calculated. Since the available quarter-end dates are dependent on the actual data set and there are different data sets in use, I feed the <code>choices</code> parameter of <code>selectInput</code> dynamically in the server function. The process is as follows:</p>
  
  <ol>
  <li>Create the <code>selectInput</code> objects dynamically conditional on the available quarter end-dates of the data set.</li>
  <li>Use the selected quarter-end dates to limit the specific data set accordingly.</li>
  </ol>
  
  <p>I do this over and over again in my app for different data sets, which is why I now want to create a module. However, I struggle to get the selected quarter-end dates back that I could then use to limit my data set.</p>
  
  <p>Below, please find a small app that illustrates my problem.</p>
  
  <p><strong>app.R part</strong></p>
  
  <pre><code>source("module.R")
  
  ui &lt;- fixedPage(
    selectQuartersUI("test"),
    textOutput("summary")
  )
  
  server &lt;- function(input, output, session) {
  
    ### Here I want to save the selected input
    #(Use 1:10 for illustration purposes, this would actually be 
    #quarter end-dates that are dynamic based on the specific data set)
    testValues &lt;- callModule(selectQuarters, "test", 1:10) 
  
    ### Use the selected input (here to simply output them, in actual app to limit data set)
    #Using testValues returns long function call, calling testValues() returns "Error: could not find function "testValues""
    output$summary &lt;- renderText({
      sprintf(paste0("Start: ", testValues(), collapse = "_"))
    })
  }
  
  shinyApp(ui, server)
  </code></pre>
  
  <p><strong>module.R part</strong></p>
  
  <pre><code>selectQuartersUI &lt;- function(id) {
  
    ns &lt;- NS(id)
  
    fluidRow(
      column(3, htmlOutput(ns("startQuarter"))),
      column(3, htmlOutput(ns("endQuarter")))
    )
  
  }
  
  selectQuarters &lt;- function(input, output, session, vec_dates) {
  
    vec_dates &lt;- sort(unique(vec_dates))
  
    output$startQuarter &lt;-  renderUI({
      ns &lt;- session$ns
      selectInput(ns("startQuarter"), "Start:", vec_dates[1:(length(vec_dates)-1)],
                  multiple = FALSE,
                  selected =  max(vec_dates[1:(length(vec_dates)-1)])) 
    })
  
    output$endQuarter  &lt;- renderUI({
      ns &lt;- session$ns #See "Using renderUI within modules" part in tutorial
      selectInput(ns("endQuarter"), "End:", vec_dates,
                  multiple = FALSE,
                  selected =  max(vec_dates)) #3nd latest quarter
    })
  
    #See tutorial: "If a module wants to return reactive expressions to the calling app, 
    #               then return a list of reactive expressions from the function
    # Using c() instead causes the same issues
    return(list(reactive({input$startQuarter}), 
                reactive({input$endQuarter})))
  
  }
  </code></pre>
  
  <p>The part that fails is to return the selected quarter-end dates in <code>testValues</code>, but I'm struggling to see why.</p>