title: How to print out the data frame along with ggplot2 charts in the same page in shiny
body: <p>I am a little confused about printing the dynamic output while using R in shiny. The following are my code in shiny, it can just print out the ggplot2 charts, but not along with the new data frame. I just wanna know how to print out &quot;mydata&quot; at the same time. Thanks.</p>
  <pre><code>library(&quot;reshape2&quot;)
  library(&quot;ggplot2&quot;)
  </code></pre>
  <h1>Server.R</h1>
  <pre><code>shinyServer(function(input, output) {
  
  output$main_plot &lt;- renderPlot({
      #Draw gragh to compare the forecast values with real data
      mydata &lt;- data.frame(years, A, B)   
      df &lt;- melt(mydata,  id = 'years', variable = 'series')      
      print(ggplot(df, aes(years,value)) + geom_line(aes(colour = series), size=1.5))
      
  })
  </code></pre>
  <h1>Ui.R</h1>
  <pre><code>shinyUI(pageWithSidebar(
  
  # Sidebar with controls to select a dataset
  # of observations to view
   
  sidebarPanel(
   
  selectInput(&quot;dataset&quot;, &quot;Choose a dataset:&quot;, 
        choices = c(&quot;Netflix&quot;))),
    
  plotOutput(outputId = &quot;main_plot&quot;, height = &quot;500px&quot;)
   
  ))
  </code></pre>