4

I can't seem to use write.csv on shiny server. I get this error:

cannot open file 'data/Available.csv': Permission denied

I have read this (https://groups.google.com/forum/#!topic/shiny-discuss/srWETT6uL-I) and as a result tried this:

sudo chown shiny:shiny /path_to_app/data

But still no luck. I am using the following function from Dean Attali's post (http://deanattali.com/blog/shiny-persistent-data-storage/):

outputDir <- "data"

saveData <- function(data) {
  # Write the file to the local system
  write.csv(
    x = data,
    file = file.path(outputDir, "Available.csv") 

  )
}

In combination with:

observeEvent(input$swafer, {

    saveData(values1$available)

  })

... to write my .csv file. Perhaps I need to be logged in as admin on the server to allocate permission (currently logged in as user)? Or does my outputDir perhaps have to be the full extension?

EDIT

It seems if I change the outputDir to anything other than data it works. I guess data is a special sub-directory in shiny.

Pete900
  • 2,016
  • 1
  • 21
  • 44

0 Answers0