title: How to update shiny module with reactive dataframe from another module
body: <p>The goal of this module is create a reactive barplot that changes based on the output of a data selector module. Unfortunately the barplot does not update. It's stuck at the first variable that's selected.</p>
  <p>I've tried creating observer functions to update the barplot, to no avail. I've also tried nesting the selector server module within the barplot module, but I get the error: Warning: Error in UseMethod: no applicable method for 'mutate' applied to an object of class &quot;c('reactiveExpr', 'reactive', 'function')&quot;</p>
  <p>I just need some way to tell the barplot module to update whenever the data it's fed changes.</p>
  <p><strong>Barplot Module:</strong></p>
  <pre><code>#UI
  
  barplotUI &lt;- function(id) {
    tagList(plotlyOutput(NS(id, &quot;barplot&quot;), height = &quot;300px&quot;))
  }
  
  #Server
  #' @param data Reactive element from another module: reactive(dplyr::filter(austin_map, var == input$var)) 
  barplotServer &lt;- function(id, data) {
    moduleServer(id, function(input, output, session) {
      #Data Manipulation
      bardata &lt;- reactive({
        bar &lt;-
          data  |&gt;
          mutate(
            `&gt; 50% People of Color` = if_else(`% people of color` &gt;= 0.5, 1, 0),
            `&gt; 50% Low Income` = if_else(`% low-income` &gt;= 0.5, 1, 0)
          )
        
        total_av &lt;- mean(bar$value)
        poc &lt;- bar |&gt; filter(`&gt; 50% People of Color` == 1)
        poc_av &lt;- mean(poc$value)
        lowincome &lt;- bar |&gt; filter(`&gt; 50% Low Income` == 1)
        lowincome_av &lt;- mean(lowincome$value)
        bar_to_plotly &lt;-
          data.frame(
            y = c(total_av, poc_av, lowincome_av),
            x = c(&quot;Austin Average&quot;,
                  &quot;&gt; 50% People of Color&quot;,
                  &quot;&gt; 50% Low Income&quot;)
          )
        
        return(bar_to_plotly)
      })
      
      #Plotly Barplot
      output$barplot &lt;- renderPlotly({
        plot_ly(
          x = bardata()$x,
          y = bardata()$y,
          color = I(&quot;#00a65a&quot;),
          type = 'bar'
          
        ) |&gt;
          config(displayModeBar = FALSE)
        
      })
    })
  }
  </code></pre>
  <p><strong>EDIT :</strong>
  <strong>Data Selector Module</strong></p>
  <pre><code>dataInput &lt;- function(id) {
    tagList(
      pickerInput(
        NS(id, &quot;var&quot;),
        label = NULL,
        width = '100%',
        inline = FALSE,
        options = list(`actions-box` = TRUE,
                       size = 10),
        choices =list(
              &quot;O3&quot;,
              &quot;Ozone - CAPCOG&quot;,
              &quot;Percentile for Ozone level in air&quot;,
              &quot;PM2.5&quot;,
              &quot;PM2.5 - CAPCOG&quot;,
              &quot;Percentile for PM2.5 level in air&quot;)
      )
    )
  }
  
  dataServer &lt;- function(id) {
    moduleServer(id, function(input, output, session) {
      austin_map &lt;- readRDS(&quot;./data/austin_composite.rds&quot;)
      austin_map &lt;- as.data.frame(austin_map)
      austin_map$value &lt;- as.numeric(austin_map$value)
      
      list(
        var = reactive(input$var),
        df = reactive(austin_map |&gt; dplyr::filter(var == input$var))
      )
      
    })
  }
  </code></pre>
  <p><strong>Simplified App</strong></p>
  <pre><code>library(shiny)
  library(tidyverse)
  library(plotly)
  
  source(&quot;barplot.r&quot;)
  source(&quot;datamod.r&quot;)
  
  
  ui = fluidPage(
    fluidRow(
      dataInput(&quot;data&quot;),
      barplotUI(&quot;barplot&quot;)
      )
    )
  
  server &lt;- function(input, output, session) {
    data &lt;- dataServer(&quot;data&quot;)
    variable &lt;- data$df
    
    
    barplotServer(&quot;barplot&quot;, data = variable())
    
  }
  
  shinyApp(ui, server)
  
  </code></pre>