title: R Shiny database management
body: <p>I have an RStudio Shiny app that saves user data in a subdirectory where my shiny app is hosted. What is the best way to <code>store</code> the data and <code>access</code> it?</p>
  
  <p>The relevant part of the code is something like this:</p>
  
  <pre><code># Save all answers after click on "submit"
  observe({
    if(is.null(input$submit) || input$submit == 0) {return()}
    filename &lt;- paste0("/data/answers-",input$userName, "-", as.numeric(Sys.time()), ".RData")
    save(values$A, file = filename, compress = "xz")
  })
  </code></pre>
  
  <p><strong>The app works: the data is successfully saved in the data subdirectory on the server.</strong> </p>
  
  <p><strong>Edit:</strong> I save the data as .RData, assuming that's a natural approach. If I save the data as .csv, it looks like this:</p>
  
  <pre><code>"What do you think about this?","Excellent","Excellent"
  "What do you think about that?","Excellent","Excellent"
  "User Unique ID","ABC123","DEF456"
  </code></pre>
  
  <p>except that there are more rows and more columns.</p>
  
  <p>One approach would be to periodically download the data from the server and delete it on the server if it exceeds a critical size (to prevent it from taking up too much space). How best to do that?</p>
  
  <p>Any tips on database management are welcome.</p>
  
  <p>I am cross-posting from shiny-discuss, where my question has not yet generated any reaction:</p>
  
  <p><a href="https://groups.google.com/forum/#!topic/shiny-discuss/gOEtUsh00Qs" rel="nofollow">https://groups.google.com/forum/#!topic/shiny-discuss/gOEtUsh00Qs</a></p>