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 store
the data and access
it?
The relevant part of the code is something like this:
# Save all answers after click on "submit"
observe({
if(is.null(input$submit) || input$submit == 0) {return()}
filename <- paste0("/data/answers-",input$userName, "-", as.numeric(Sys.time()), ".RData")
save(values$A, file = filename, compress = "xz")
})
The app works: the data is successfully saved in the data subdirectory on the server.
Edit: I save the data as .RData, assuming that's a natural approach. If I save the data as .csv, it looks like this:
"What do you think about this?","Excellent","Excellent"
"What do you think about that?","Excellent","Excellent"
"User Unique ID","ABC123","DEF456"
except that there are more rows and more columns.
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?
Any tips on database management are welcome.
I am cross-posting from shiny-discuss, where my question has not yet generated any reaction:
https://groups.google.com/forum/#!topic/shiny-discuss/gOEtUsh00Qs