title: R shiny: how to save input data to the server or access input variables globally?
body: <p>I am making an application that asks the user a few basic survey questions. When this is done they are asked to provide a numeric input via a slidebar, press continue, then generate a plot, asks the user for input again, updates the plot, etc. The first input should be y1 on the plot, and the second input should be y2 on the plot, ect. But in addition I would like to save the data the user is inputting, so that I can access it in my R script globally, so it can be sent to me using sendmailR or so that it could be downloaded onto my computer as a text file. But I am having trouble figuring out how to do this. Here is what I have so far.</p>
  
  <pre><code>n=10 #number of times to ask the user for input which will be stored in harv[i]
  Time = seq(n)
  harv = rep(0,n) #initializing vector for storage of user input at time 1 through n
  
  ############### define server logic
  
  shinyServer(function(input, output){
  
    # Compute the forumla text in a reactive expression since it is 
    # shared by the output$caption and output$mpgPlot expressions
    for(i in Time){
  
    # generate a plot
    output$yieldplot &lt;- renderPlot({
     harv[i] = input$harvest
     plot(Time, harv, type='p', ylim=c(0,1))
    })
  
   }#for
  
  })
  </code></pre>
  
  <p>Here is the ui.R file</p>
  
  <pre><code>###########################################
  #####   User Interface  ###################
  ###########################################
  
  library(shiny)
  
  #Define UI for app
  shinyUI(pageWithSidebar(
  
    #title  
    headerPanel("Game"),
    mainPanel(   selectInput("workexp", "Have you ever been employed:",
                              list("No"="no", "Yes" = "yes")),    
                 sliderInput("push", "Choose a number", 
                             min = 0, max = 1, value = 0.5, step= 0.01),
                 submitButton("Enter"),
                 plotOutput("yieldplot")                                                  
    )#mainpanel
  
  ))#shinyUI  
  </code></pre>
  
  <p>Also my for loop to try and generate the plot over and over will not work, I assume I need to do something reactive but I need to figure out a way to plot past user defined entries all stored in harv. I looked into downloadHanlder but this downloads data and plots on the user's computer.</p>