(Shiny, R) Making histogram from csv file (with column selection via combobox/Select input.
<p>I have another problem with my aplication. I need to add histogram function to it.</p>

<p>On third tab application should create histogram from uploaded file (column is selected via combobox/selectinput).</p>

<p>Application can actually create combobox with columns from csv file.</p>

<p>But when i want to make histogram, on tab "Histogram only displays error:</p>

<pre><code>ERROR: object of type 'closure' is not subsettable
</code></pre>

<p>I dont know what i made wrong.</p>

<p>There is code</p>

<pre><code>ui &lt;- shinyUI(fluidPage(
  titlePanel("Aplikacja testowa nr 6. Praca z plikiem- wybór kolumny"),

  sidebarLayout(
    sidebarPanel(
      fileInput("file", label = h3("Wgraj Plik")),
      checkboxInput(inputId = 'header', label = 'Pierwszy wers to etykiety', value = FALSE),
      radioButtons(inputId = 'sep', label = 'Co jest separatorem', choices = c("Przecinek"=',',"Średnik"=';',"Tabulator"='\t', "Spacja"=''), selected = ','),

      checkboxGroupInput("choices1", label = h3("Wybierz Kolumny"), choices = NULL),
      # there is combobox to pick column
        selectInput("combobox", label = h3("(Histogram) Wybierz kolumne"),  choices = NULL)





    ),

    mainPanel(
       uiOutput("tb")
    )
  )
))

server &lt;- function(input, output, session){

  data &lt;- reactive({
    file1 &lt;- input$file
    if(is.null(file1)){return()} 
    dataSet &lt;- read.csv(file=file1$datapath, sep=input$sep, header = input$header )

    updateCheckboxGroupInput(session, "choices1", choices = colnames(dataSet))
      # this line updates selection in combobox 
    updateSelectInput(session, "combobox", choices = colnames(dataSet))

    dataSet
  })

  output$table &lt;- renderTable({
    if(is.null(data())){return ()}
    data()    
  })

  output$table2 &lt;- renderTable({


    if(is.null(data()) || is.null(input$choices1)){return ()}
    data()[input$choices1]    
  })

# there is part of file where i make histogram
 output$wykres &lt;- renderPlot({
x    &lt;- data[0, input$combobox] 
 hist(x , col = 'blue', border = 'white')
})


  output$tb &lt;- renderUI({
    if(is.null(data()))
      h5("Wgraj Plik jeśli chcesz cokolwiek zrobić.")
    else
      tabsetPanel(tabPanel("dane", tableOutput("table")),tabPanel("wybrane kolumny", tableOutput("table2")), tabPanel("Histogram", plotOutput("wykres")))
  })
}

shinyApp(ui, server)
</code></pre>