title: I test ran my shiny app and it worked. However, it gives me an error when I uploaded it to shinyapp.io and ran it
body: <p>I ran my shiny app on shinyapp.io server and it gave me this error:</p>
  
  <p>"ERROR: object of type 'closure' is not subsettable"</p>
  
  <p>I have following server.R and UI.R files:</p>
  
  <p>SERVER.R</p>
  
  <pre><code>library(shiny)
  library(data.table)
  library(dplyr)
  library(ggplot2)
  
  data &lt;- data.table::fread(input="final_master_table.csv",header = TRUE,     data.table = TRUE)
  data &lt;- data[,V1:=NULL]
  
  shinyServer(function(input, output){
  
  selected_data &lt;- reactive({
  
  minyear &lt;- input$year[1]
  maxyear &lt;- input$year[2]
  
  velo &lt;- data %&gt;% group_by(pitcher_name, pitch_type, Year) %&gt;% summarise(velocity = mean(start_speed)) %&gt;%
    arrange(velocity) %&gt;% filter(pitcher_name %in% input$pitcher_name) %&gt;% arrange(pitcher_name) %&gt;% filter(Year &gt;= minyear) %&gt;% filter(Year &lt;= maxyear) %&gt;% filter(pitch_type %in% input$pitch_type)
  print(velo)
   })
  
  output$pitcher_bar &lt;- renderPlot({
  
  p &lt;- ggplot(data=selected_data(), aes(x = Year, y = velocity, group = pitch_type, color = pitch_type)) + geom_line() + geom_point(size=3, fill="white") + xlab("Year") + ylab("Velocity") + ggtitle("Velocity") + theme_bw()
  print(p)
  })
  
  
  })
  </code></pre>
  
  <p>UI.R</p>
  
  <pre><code> library(shiny)
   library(data.table)
   library(dplyr)
   library(ggplot2)
  
  shinyUI(fluidPage(
  
  titlePanel("Velocity Attribute"),
  
  sidebarLayout(
  
  sidebarPanel(
  
  # Slider for setting year parameter
  
  sliderInput("year",
              "year:",
              min=2008,max=2015,value=c(2008,2015)
              ),
  
  selectInput("pitcher_name","Pitcher Name:", choices = unique(data$pitcher_name)),
  
  selectInput("pitch_type","Pitch Type:", choices = unique(data$pitch_type)),
  
  helpText("Please wait 30 seconds for 2008 to 2015 pitchFx data to load")
  
  ),
  
  mainPanel(plotOutput("pitcher_bar"))
  
  )))
  </code></pre>
  
  <p>I am suspecting that the adjustments need to be made has to do with data variable?</p>