I'm currently usinga shiny server using DigitalOcean with Ubuntu as the operating system. I created a survey with the hopes of collecting user inputs and writing them in a csv file.
Locally, it works (i.e. responses get saved in a local folder). However, when I developed a shiny app within my new R Studio server to test it, there is an error which reads:
"Error: cannot open the connection"
This occurs when I press the submit button. I think the error occurs because my shiny server doesn't have rights to save files in my desired folder, i.e.
/home/my_user/test
The folder I'd save the responses would be located in that shiny folder in my new R Studio directory.
I've checked extensively on the website and I found:
Write permission from shiny app
Permission denied while using write.csv on ubuntu server
This is my saveData function:
saveData <- function(data) {
fileName <- sprintf("%s_%s.csv", humanTime(), digest::digest(data))
write.csv(x = data, file = file.path(responsesDir, fileName), row.names = FALSE, quote = TRUE)
}
The response directory (responsesDir) is
/home/my_user/test/csv_files
I've tried the following:
sudo chown shiny:shiny /var/shiny-server/test/
It says that there is no such file or directory.
Am I missing something very obvious? Thank you so much!