title: How to plot uploaded dataset using shiny?
body: <p>I'm new to R-shiny apps, My application is very simple. It has two tabs, in the first, I upload a file such as csv, then in the second tab, I choose the columns that will be plotted, My solution is scattered over several example each is not the same as mine, I want the uploaded dataset to be seen and can be used in all functions not just only when uploading it.</p>
  
  <p>my server.R</p>
  
  <pre><code>library(shiny)
  shinyServer(function(input, output) {
  output$contents &lt;- renderTable({
  inFile &lt;- input$file1
  
  if (is.null(inFile))
    return(NULL)
  read.csv(inFile$datapath, header=input$header, sep=input$sep, 
           quote=input$quote)
  
  })
  output$MyPlot &lt;- renderPlot({
  x    &lt;- contents()$contents[, c(input$xcol, input$ycol)]
  bins &lt;- nrow(contents())
  hist(x, breaks = bins, col = 'darkgray', border = 'white')
  })
  })
  </code></pre>
  
  <p>ui.R</p>
  
  <pre><code>library(shiny)
  library(datasets)
  shinyUI(fluidPage(
  titlePanel("Column Plot"),
  tabsetPanel(
  tabPanel("Upload File",
           titlePanel("Uploading Files"),
           sidebarLayout(
             sidebarPanel(
               fileInput('file1', 'Choose CSV File',
                         accept=c('text/csv', 
                                  'text/comma-separated-values,text/plain', 
                                  '.csv'))
  
        ),
             mainPanel(
               tableOutput('contents')
             )
           )
  ),
  tabPanel("First Type",
           pageWithSidebar(
             headerPanel('My First Plot'),
             sidebarPanel(
               selectInput('xcol', 'X Variable', names(content)),
               selectInput('ycol', 'Y Variable', names(content),
                           selected=names(content)[[2]])
             ),
             mainPanel(
               plotOutput('MyPlot')
             )
           )
  )
  
  )
  )
  )
  </code></pre>
  
  <p>I've tried to that, but I'm just starting that so, what should I do please?</p>