title: R shiny, subscript out of bounds
body: <p>I'm working with simple Shiny app in R, but I face this error in the app:</p>
  
  <blockquote>
    <p>subscript out of bounds</p>
  </blockquote>
  
  <p>The idea is to have a sidebar panel where you can choose vocal or consonant, and a barplot that visualize some letters with some numbers, clearly, choosing a vocal,vocals are with values, and so on with the consonant.</p>
  
  <p>Here my code</p>
  
  <p>First, I create the data:</p>
  
  <pre><code>x1&lt;-c(1,2,6,3,8)
  y1&lt;-c('a','b','c','d','e')
  z1&lt;-c('V','C','C','C','V')
  df&lt;-data.frame(x1,y1,z1)
  
  data.m &lt;- melt(df, id=c(2:3), measure=c(1))
  df2&lt;-cast(data.m , z1 ~ y1)
  df3&lt;-as.matrix(df2)
  </code></pre>
  
  <p>Here the server code:</p>
  
  <pre><code>##server
  function(input, output) {      
  
    output$Plot &lt;- renderPlot({
  
      library(reshape)
      barplot(df3[,input$letters])
  
    })
  }
  </code></pre>
  
  <p>and here the ui part</p>
  
  <pre><code>##ui
  
  
     fluidPage(    
  
    titlePanel("letters"),
  
    sidebarLayout(      
    sidebarPanel(
    selectInput("letters", "Letters", 
                choices=rownames(df3)),
     hr(),
    helpText("Types of letters")
  ),
  
  mainPanel(
    plotOutput("Plot")  
      )   
    )
  )
  </code></pre>
  
  <p>Well the error is the one in the title. Could you help me?
  Furthermore, is there any way to put the data into the Shiny app to have them loaded when you start the app?
  Thanks a lot in advance</p>