title: Shiny subset closure error upon deployment
body: <p>I'm nearly complete with my Shiny app, but keep running into an error.</p>
  <p>Here is the script, for reference:</p>
  <p>UI is as follows:</p>
  <pre><code>library(dbplyr)
  library(dplyr)
  library(shiny)
  library(shinyWidgets)
  library(DT)
  library(sqldf)
  
  ui &lt;- fluidPage(
    titlePanel(&quot;Shiny App&quot;),
    sidebarLayout(
      sidebarPanel(
        radioButtons(&quot;mydata&quot;, label = &quot;C4 or C3?&quot;, choices = c(&quot;C4&quot;,&quot;C3&quot;), inline=TRUE),
        selectizeInput(&quot;data1&quot;, &quot;Select State&quot;, selected = &quot;MI&quot;, multiple = TRUE, choices = c(unique(sort(df$state)))),
        selectizeInput(&quot;data2&quot;, &quot;Select County&quot;, choices = NULL),
        selectizeInput(&quot;data3&quot;, &quot;Select City&quot;, selected = &quot;DETROIT&quot;, choices = NULL, multiple = TRUE),
        selectizeInput(&quot;data4&quot;, &quot;Select Demo&quot;, choices = c(&quot;All&quot;, unique(sort(df$demo)))),
        selectizeInput(&quot;data5&quot;, &quot;Select Registration Status&quot;, choices = c(&quot;All&quot;, unique(sort(df$registration_status)))),
        selectizeInput(&quot;data6&quot;, &quot;Valid Address&quot;, choices = c(&quot;All&quot;, unique(sort(df$vb_voterbase_mailable_flag)))),
        sliderInput(&quot;age&quot;, label = h3(&quot;Select Age Range&quot;), 18,
                    35, value = c(18, 20), round = TRUE, step = 1),
        sliderInput(&quot;turnout&quot;, label = h3(&quot;Select Range&quot;), min = 0,
                    max = 100, value = c(20,80)),
        conditionalPanel(condition = &quot;input.mydata=='C4'&quot;,
                         sliderInput(&quot;partisan&quot;, label = h3(&quot;Select Range&quot;), min = 0, max = 100, value = c(20,80))
        ),
        prettyCheckboxGroup(&quot;phones&quot;, h3(&quot;Only Include Valid Phone Numbers?&quot;), selected = &quot;Yes&quot;, choices = list(&quot;Yes&quot;)),
        downloadButton(&quot;download&quot;, &quot;Download Data&quot;)
      ),
      mainPanel(
        textOutput(&quot;universecount&quot;),
        tags$head(tags$style(&quot;#universecount{color: red;
                                   font-size: 32px;
                                   font-style: italic;
                                   }&quot;
        )
        )
      )
    )
  )
  </code></pre>
  <p>And now the Server.R file:</p>
  <pre><code>server &lt;- function(input, output, session){
    
    mydf &lt;- reactive({get(input$mydata)})
    observeEvent(input$data1, {
      df &lt;- mydf()
      #if (input$data1 != &quot;All&quot;) {
      updateSelectizeInput(session, &quot;data2&quot;, &quot;Select County&quot;, server = TRUE, choices = c(&quot;All&quot;, unique(sort(df$county[df$state == input$data1]))))
      # } else {
      #   updateSelectizeInput(session, &quot;data2&quot;, &quot;Select County&quot;, server = TRUE, choices = c(&quot;All&quot;, unique(df$county)))
      # }
    }, priority = 2)
    
    observeEvent(c(input$data1, input$data2), {
      req(mydf())
      df &lt;- mydf()
      if (input$data2 != &quot;All&quot;) {
        updateSelectizeInput(session, &quot;data3&quot;, &quot;Select City&quot;, server = TRUE, choices = c(&quot;All&quot;, unique(sort(df$city[df$county == input$data2]))))
      } else {
        #if (input$data1 != &quot;All&quot;) {
        updateSelectizeInput(session, &quot;data3&quot;, &quot;Select City&quot;, server = TRUE, choices = c(&quot;All&quot;, unique(sort(df$city[df$state == input$data1]))))
        # } else {
        #   updateSelectizeInput(session, &quot;data3&quot;, &quot;Select City&quot;, server = TRUE, choices = c(&quot;All&quot;, unique(df$city)))
        # }
      }
    }, priority = 1)
    
    filtered_data &lt;- reactive({
      req(input$data3)
      temp_data &lt;- mydf()
      if (input$data1 != &quot;All&quot;) {
        temp_data &lt;- temp_data[temp_data$state %in% input$data1, ]
      }
      if (input$data2 != &quot;All&quot;) {
        temp_data &lt;- temp_data[temp_data$county == input$data2, ]
      }
      if (input$data3 != &quot;All&quot;) {
        temp_data &lt;- temp_data[temp_data$city %in% input$data3, ]
      }
      if (input$data4 != &quot;All&quot;) {
        temp_data &lt;- temp_data[temp_data$demo %in% input$data4, ]
      }
      if (input$data5 != &quot;All&quot;) {
        temp_data &lt;- temp_data[temp_data$registration_status %in% input$data5, ]
      }
      if (input$data6 != &quot;All&quot;) {
        temp_data &lt;- temp_data[temp_data$vb_voterbase_mailable_flag == input$data, ]
      }
      
      df2 &lt;- temp_data %&gt;% dplyr::filter(age &gt;= input$age[1] &amp;
                                           age &lt;= input$age[2] &amp;
                                           turnout_score &gt;= input$turnout[1] &amp;
                                           turnout_score &lt;= input$turnout[2])
      if (input$mydata==&quot;C4&quot;) df2 &lt;- df2 %&gt;% dplyr::filter(partisan_score &gt;= input$partisan[1] &amp; partisan_score &lt;= input$partisan[2])
      
      df3 &lt;- if (is.null(input$phones)) df2 else df2 %&gt;%  dplyr::filter(!is.na(phone))
      
    })
    
    output$universecount &lt;- renderText({
      paste(&quot;Universe Size:&quot;, nrow(filtered_data()))
    })
    
  }
  </code></pre>
  <p>If I run it locally, it works totally fine. But the issue is when I push it to my Shiny deployment server.</p>
  <p>I get the following messages in my logs:</p>
  <pre><code>2022-01-19T22:54:48.561849+00:00 shinyapps[5182547]: Warning: Error in $: object of type 'closure' is not subsettable
  2022-01-19T22:54:48.569921+00:00 shinyapps[5182547]:   105: sort
  </code></pre>
  <p>I have a feeling the error might live in this part of the server side script, but I've tried debugging based on prior answers and keep getting the same issue.</p>
  <pre><code> output$universecount &lt;- renderText({
      paste(&quot;Universe Size:&quot;, nrow(filtered_data()))
    })
  </code></pre>
  <p>I'm also not exactly sure what the <code>105: sort</code> message means. Are they related?</p>
  <p>EDIT: Here is the dput for <code>df</code>:</p>
  <pre><code>structure(list(unique_id = c(36363789L, 18988964L, 16094523L, 
  39677134L, 4078215L, 28493633L, 3783112L, 18484012L, 13989489L, 
  14328803L, 14309304L, 9348817L, 33081795L, 32954689L, 30115329L, 
  17177505L, 34680537L, 13908098L, 5946723L, 6684694L, 28609274L, 
  1843719L, 20634959L, 5471321L, 26713947L, 17588681L, 30571179L, 
  17325937L, 29977204L, 9818333L, 17183018L, 9779557L, 6048733L, 
  18017770L, 21816931L, 5974829L, 16954800L, 38106102L, 5335207L, 
  8832897L, 32329461L, 15254291L, 14297262L, 39515748L, 31867131L, 
  31508617L, 31820666L, 33267058L, 20008072L, 13527430L), state = c(&quot;TX&quot;, 
  &quot;NC&quot;, &quot;MI&quot;, &quot;TX&quot;, &quot;NV&quot;, &quot;TX&quot;, &quot;AZ&quot;, &quot;MI&quot;, &quot;MI&quot;, &quot;NC&quot;, &quot;MI&quot;, &quot;AZ&quot;, 
  &quot;TX&quot;, &quot;TX&quot;, &quot;TX&quot;, &quot;NC&quot;, &quot;TX&quot;, &quot;MI&quot;, &quot;NV&quot;, &quot;MI&quot;, &quot;TX&quot;, &quot;TX&quot;, &quot;PA&quot;, 
  &quot;MI&quot;, &quot;TX&quot;, &quot;NC&quot;, &quot;TX&quot;, &quot;MI&quot;, &quot;TX&quot;, &quot;WI&quot;, &quot;MI&quot;, &quot;AZ&quot;, &quot;MI&quot;, &quot;NC&quot;, 
  &quot;PA&quot;, &quot;MI&quot;, &quot;MI&quot;, &quot;TX&quot;, &quot;NV&quot;, &quot;AZ&quot;, &quot;TX&quot;, &quot;MI&quot;, &quot;MI&quot;, &quot;TX&quot;, &quot;TX&quot;, 
  &quot;TX&quot;, &quot;TX&quot;, &quot;TX&quot;, &quot;PA&quot;, &quot;PA&quot;), city = c(&quot;BROWNSVILLE&quot;, &quot;BURNSVILLE&quot;, 
  &quot;PORT AUSTIN&quot;, &quot;NEW BRAUNFELS&quot;, &quot;NORTH LAS VEGAS&quot;, &quot;SAN ANTONIO&quot;, 
  &quot;ARIZONA CITY&quot;, &quot;ROCKFORD&quot;, &quot;WARREN&quot;, &quot;CHARLOTTE&quot;, &quot;PINCKNEY&quot;, 
  &quot;PHOENIX&quot;, &quot;BUDA&quot;, &quot;FORT WORTH&quot;, &quot;LOCKHART&quot;, &quot;MATTHEWS&quot;, &quot;SAN ANTONIO&quot;, 
  &quot;LIVONIA&quot;, &quot;LAS VEGAS&quot;, &quot;JENISON&quot;, &quot;GOLIAD&quot;, &quot;CADDO MILLS&quot;, &quot;MEADVILLE&quot;, 
  &quot;BANCROFT&quot;, &quot;LITTLE ELM&quot;, &quot;ASHEVILLE&quot;, &quot;SAN MARCOS&quot;, &quot;HAZEL PARK&quot;, 
  &quot;HOUSTON&quot;, &quot;CHIPPEWA FALLS&quot;, &quot;SOUTH LYON&quot;, &quot;QUEEN CREEK&quot;, &quot;WYOMING&quot;, 
  &quot;GREENSBORO&quot;, &quot;FELTON&quot;, &quot;CHARLEVOIX&quot;, &quot;WATERFORD&quot;, &quot;HUMBLE&quot;, 
  &quot;RENO&quot;, &quot;SAN TAN VALLEY&quot;, &quot;HOUSTON&quot;, &quot;NEW BUFFALO&quot;, &quot;PAW PAW&quot;, 
  &quot;HOUSTON&quot;, &quot;ARLINGTON&quot;, &quot;AUSTIN&quot;, &quot;ARLINGTON&quot;, &quot;SCHERTZ&quot;, &quot;LANCASTER&quot;, 
  &quot;SHIPPENSBURG&quot;), county = c(&quot;CAMERON&quot;, &quot;YANCEY&quot;, &quot;HURON&quot;, &quot;COMAL&quot;, 
  &quot;CLARK&quot;, &quot;BEXAR&quot;, &quot;PINAL&quot;, &quot;KENT&quot;, &quot;MACOMB&quot;, &quot;MECKLENBURG&quot;, &quot;LIVINGSTON&quot;, 
  &quot;MARICOPA&quot;, &quot;HAYS&quot;, &quot;TARRANT&quot;, &quot;CALDWELL&quot;, &quot;UNION&quot;, &quot;BEXAR&quot;, 
  &quot;WAYNE&quot;, &quot;CLARK&quot;, &quot;OTTAWA&quot;, &quot;GOLIAD&quot;, &quot;HUNT&quot;, &quot;CRAWFORD&quot;, &quot;SHIAWASSEE&quot;, 
  &quot;DENTON&quot;, &quot;BUNCOMBE&quot;, &quot;CALDWELL&quot;, &quot;OAKLAND&quot;, &quot;HARRIS&quot;, &quot;CHIPPEWA&quot;, 
  &quot;OAKLAND&quot;, &quot;MARICOPA&quot;, &quot;KENT&quot;, &quot;GUILFORD&quot;, &quot;YORK&quot;, &quot;CHARLEVOIX&quot;, 
  &quot;OAKLAND&quot;, &quot;HARRIS&quot;, &quot;WASHOE&quot;, &quot;PINAL&quot;, &quot;HARRIS&quot;, &quot;BERRIEN&quot;, 
  &quot;VAN BUREN&quot;, &quot;HARRIS&quot;, &quot;TARRANT&quot;, &quot;TRAVIS&quot;, &quot;TARRANT&quot;, &quot;GUADALUPE&quot;, 
  &quot;LANCASTER&quot;, &quot;CUMBERLAND&quot;), age = c(34L, 23L, 21L, 19L, 26L, 
  26L, 30L, 18L, 26L, 25L, 24L, 22L, 22L, 22L, 30L, 34L, 30L, 28L, 
  29L, 35L, 27L, 33L, 35L, 35L, 27L, 20L, 24L, 34L, 35L, 26L, 20L, 
  24L, 31L, 23L, 21L, 31L, 31L, 20L, 33L, 25L, 32L, 27L, 24L, 19L, 
  31L, 31L, 33L, 35L, 23L, 35L), demo = c(&quot;Hispanic&quot;, &quot;Caucasian&quot;, 
  &quot;Caucasian&quot;, &quot;Caucasian&quot;, &quot;Caucasian&quot;, &quot;African-American&quot;, &quot;Caucasian&quot;, 
  &quot;Caucasian&quot;, &quot;Caucasian&quot;, &quot;Caucasian&quot;, &quot;Caucasian&quot;, &quot;Hispanic&quot;, 
  &quot;Caucasian&quot;, &quot;Caucasian&quot;, &quot;Caucasian&quot;, &quot;Caucasian&quot;, &quot;Hispanic&quot;, 
  &quot;Uncoded&quot;, &quot;Caucasian&quot;, &quot;Caucasian&quot;, &quot;Caucasian&quot;, &quot;Caucasian&quot;, 
  &quot;Caucasian&quot;, &quot;Caucasian&quot;, &quot;Caucasian&quot;, &quot;Caucasian&quot;, &quot;Caucasian&quot;, 
  &quot;Caucasian&quot;, &quot;Caucasian&quot;, &quot;Caucasian&quot;, &quot;Caucasian&quot;, &quot;Caucasian&quot;, 
  &quot;Uncoded&quot;, &quot;African-American&quot;, &quot;Caucasian&quot;, &quot;Caucasian&quot;, &quot;Caucasian&quot;, 
  &quot;African-American&quot;, &quot;Caucasian&quot;, &quot;Caucasian&quot;, &quot;Caucasian&quot;, &quot;Caucasian&quot;, 
  &quot;Uncoded&quot;, &quot;Caucasian&quot;, &quot;Caucasian&quot;, &quot;Hispanic&quot;, &quot;African-American&quot;, 
  &quot;Caucasian&quot;, &quot;Caucasian&quot;, &quot;Caucasian&quot;), turnout_score = c(5.9, 
  54.1, 3.6, 18.4, 1.5, 6.5, 28.3, 21.4, 88.7, 35.4, 20.4, 70.8, 
  65, 5.8, 17.5, 4.4, 23.1, 81.8, 45.5, 63.3, 3.8, 32.4, 31.4, 
  89.4, 8.8, 9.1, 3.2, 12.6, 48.5, 24.7, 68.1, 2.9, 23.6, 50, 10.5, 
  72.3, 83.8, 16.9, 29.5, 20.2, 4.6, 46.9, 65.9, 14.1, 8, 2.5, 
  20.5, 39, 22.6, 52.6), partisan_score = c(44.4, 1.4, 23.3, 32.7, 
  91.6, 80, 21.3, 6.9, 66.9, 2.3, 62.5, 99, 12.2, 68, 73.2, 2.2, 
  92.9, 68.4, 84.6, 10.8, 34.1, 14.7, 0.7, 2, 16.4, 5.5, 87.8, 
  71.8, 99.7, 18.7, 75.4, 6.9, 84.7, 98.5, 12.3, 1.9, 62.9, 69.9, 
  1.5, 6.9, 34.5, 42.4, 30.2, 34, 54.6, 88.9, 44.7, 71.5, 98.6, 
  0.6), first_name = c(&quot;firstname1&quot;, &quot;firstname2&quot;, &quot;firstname3&quot;, 
  &quot;firstname4&quot;, &quot;firstname5&quot;, &quot;firstname6&quot;, &quot;firstname7&quot;, &quot;firstname8&quot;, 
  &quot;firstname9&quot;, &quot;firstname10&quot;, &quot;firstname11&quot;, &quot;firstname12&quot;, &quot;firstname13&quot;, 
  &quot;firstname14&quot;, &quot;firstname15&quot;, &quot;firstname16&quot;, &quot;firstname17&quot;, &quot;firstname18&quot;, 
  &quot;firstname19&quot;, &quot;firstname20&quot;, &quot;firstname21&quot;, &quot;firstname22&quot;, &quot;firstname23&quot;, 
  &quot;firstname24&quot;, &quot;firstname25&quot;, &quot;firstname26&quot;, &quot;firstname27&quot;, &quot;firstname28&quot;, 
  &quot;firstname29&quot;, &quot;firstname30&quot;, &quot;firstname31&quot;, &quot;firstname32&quot;, &quot;firstname33&quot;, 
  &quot;firstname34&quot;, &quot;firstname35&quot;, &quot;firstname36&quot;, &quot;firstname37&quot;, &quot;firstname38&quot;, 
  &quot;firstname39&quot;, &quot;firstname40&quot;, &quot;firstname41&quot;, &quot;firstname42&quot;, &quot;firstname43&quot;, 
  &quot;firstname44&quot;, &quot;firstname45&quot;, &quot;firstname46&quot;, &quot;firstname47&quot;, &quot;firstname48&quot;, 
  &quot;firstname49&quot;, &quot;firstname50&quot;), last_name = c(&quot;lastname1&quot;, &quot;lastname2&quot;, 
  &quot;lastname3&quot;, &quot;lastname4&quot;, &quot;lastname5&quot;, &quot;lastname6&quot;, &quot;lastname7&quot;, 
  &quot;lastname8&quot;, &quot;lastname9&quot;, &quot;lastname10&quot;, &quot;lastname11&quot;, &quot;lastname12&quot;, 
  &quot;lastname13&quot;, &quot;lastname14&quot;, &quot;lastname15&quot;, &quot;lastname16&quot;, &quot;lastname17&quot;, 
  &quot;lastname18&quot;, &quot;lastname19&quot;, &quot;lastname20&quot;, &quot;lastname21&quot;, &quot;lastname22&quot;, 
  &quot;lastname23&quot;, &quot;lastname24&quot;, &quot;lastname25&quot;, &quot;lastname26&quot;, &quot;lastname27&quot;, 
  &quot;lastname28&quot;, &quot;lastname29&quot;, &quot;lastname30&quot;, &quot;lastname31&quot;, &quot;lastname32&quot;, 
  &quot;lastname33&quot;, &quot;lastname34&quot;, &quot;lastname35&quot;, &quot;lastname36&quot;, &quot;lastname37&quot;, 
  &quot;lastname38&quot;, &quot;lastname39&quot;, &quot;lastname40&quot;, &quot;lastname41&quot;, &quot;lastname42&quot;, 
  &quot;lastname43&quot;, &quot;lastname44&quot;, &quot;lastname45&quot;, &quot;lastname46&quot;, &quot;lastname47&quot;, 
  &quot;lastname48&quot;, &quot;lastname49&quot;, &quot;lastname50&quot;), phone = 1234567890:1234567939, 
      registration_status = c(&quot;Registered&quot;, &quot;Registered&quot;, &quot;Registered&quot;, 
      &quot;Registered&quot;, &quot;Registered&quot;, &quot;Registered&quot;, &quot;Registered&quot;, &quot;Registered&quot;, 
      &quot;Registered&quot;, &quot;Registered&quot;, &quot;Registered&quot;, &quot;Registered&quot;, &quot;Registered&quot;, 
      &quot;Registered&quot;, &quot;Registered&quot;, &quot;Registered&quot;, &quot;Registered&quot;, &quot;Registered&quot;, 
      &quot;Registered&quot;, &quot;Registered&quot;, &quot;Registered&quot;, &quot;Registered&quot;, &quot;Registered&quot;, 
      &quot;Registered&quot;, &quot;Registered&quot;, &quot;Registered&quot;, &quot;Registered&quot;, &quot;Registered&quot;, 
      &quot;Registered&quot;, &quot;Registered&quot;, &quot;Registered&quot;, &quot;Registered&quot;, &quot;Registered&quot;, 
      &quot;Registered&quot;, &quot;Registered&quot;, &quot;Registered&quot;, &quot;Registered&quot;, &quot;Registered&quot;, 
      &quot;Registered&quot;, &quot;Registered&quot;, &quot;Registered&quot;, &quot;Registered&quot;, &quot;Registered&quot;, 
      &quot;Registered&quot;, &quot;Registered&quot;, &quot;Registered&quot;, &quot;Registered&quot;, &quot;Registered&quot;, 
      &quot;Registered&quot;, &quot;Registered&quot;), vb_tsmart_full_address = c(&quot;1 Fake St&quot;, 
      &quot;2 Fake St&quot;, &quot;3 Fake St&quot;, &quot;4 Fake St&quot;, &quot;5 Fake St&quot;, &quot;6 Fake St&quot;, 
      &quot;7 Fake St&quot;, &quot;8 Fake St&quot;, &quot;9 Fake St&quot;, &quot;10 Fake St&quot;, &quot;11 Fake St&quot;, 
      &quot;12 Fake St&quot;, &quot;13 Fake St&quot;, &quot;14 Fake St&quot;, &quot;15 Fake St&quot;, &quot;16 Fake St&quot;, 
      &quot;17 Fake St&quot;, &quot;18 Fake St&quot;, &quot;19 Fake St&quot;, &quot;20 Fake St&quot;, &quot;21 Fake St&quot;, 
      &quot;22 Fake St&quot;, &quot;23 Fake St&quot;, &quot;24 Fake St&quot;, &quot;25 Fake St&quot;, &quot;26 Fake St&quot;, 
      &quot;27 Fake St&quot;, &quot;28 Fake St&quot;, &quot;29 Fake St&quot;, &quot;30 Fake St&quot;, &quot;31 Fake St&quot;, 
      &quot;32 Fake St&quot;, &quot;33 Fake St&quot;, &quot;34 Fake St&quot;, &quot;35 Fake St&quot;, &quot;36 Fake St&quot;, 
      &quot;37 Fake St&quot;, &quot;38 Fake St&quot;, &quot;39 Fake St&quot;, &quot;40 Fake St&quot;, &quot;41 Fake St&quot;, 
      &quot;42 Fake St&quot;, &quot;43 Fake St&quot;, &quot;44 Fake St&quot;, &quot;45 Fake St&quot;, &quot;46 Fake St&quot;, 
      &quot;47 Fake St&quot;, &quot;48 Fake St&quot;, &quot;49 Fake St&quot;, &quot;50 Fake St&quot;), 
      vb_voterbase_mailable_flag = c(&quot;Yes&quot;, &quot;Yes&quot;, &quot;Yes&quot;, &quot;Yes&quot;, 
      &quot;Yes&quot;, &quot;Yes&quot;, &quot;Yes&quot;, &quot;Yes&quot;, &quot;Yes&quot;, &quot;Yes&quot;, &quot;Yes&quot;, &quot;Yes&quot;, &quot;Yes&quot;, 
      &quot;Yes&quot;, &quot;Yes&quot;, &quot;Yes&quot;, &quot;Yes&quot;, &quot;Yes&quot;, &quot;Yes&quot;, &quot;Yes&quot;, &quot;No&quot;, &quot;Yes&quot;, 
      &quot;Yes&quot;, &quot;Yes&quot;, &quot;Yes&quot;, &quot;Yes&quot;, &quot;Yes&quot;, &quot;Yes&quot;, &quot;Yes&quot;, &quot;Yes&quot;, &quot;Yes&quot;, 
      &quot;Yes&quot;, &quot;Yes&quot;, &quot;Yes&quot;, &quot;Yes&quot;, &quot;No&quot;, &quot;Yes&quot;, &quot;Yes&quot;, &quot;Yes&quot;, &quot;Yes&quot;, 
      &quot;Yes&quot;, &quot;Yes&quot;, &quot;Yes&quot;, &quot;Yes&quot;, &quot;Yes&quot;, &quot;No&quot;, &quot;Yes&quot;, &quot;Yes&quot;, &quot;Yes&quot;, 
      &quot;Yes&quot;)), class = &quot;data.frame&quot;, row.names = c(NA, -50L))
  </code></pre>