I have a problem with my shiny app.The app file structure is like following:
/srv/shiny-server/brand/
├── data
│ ├── MDBrand.txt
│ ├── MMBrand.txt
├── helpers.R
├── js
├── server.R
└── ui.R
In helpers.R, I write a function.
puncDataToFrame <- function(file){
rawData<- as.data.frame(fread(file, sep = "\t", header = F))
data <- .....some process....
return(data)
}
In server.R, the path is like that
setwd("/srv/shiny-server/brand")
source("./helpers.R")
file1 <- "./data/MDBrand.txt"
file2 <- "./data/MMBrand.txt"
brandMonthlyUserByDay <- puncDataToFrame(file1)
brandMonthlyUserByMonth <- puncDataToFrame(file2)
When I open the server.R in Rstudio and click runApp. Everything works well.But When I run it in the shiny-server, there is always an error like that:
Error in fread(file, sep = "\t", header = F) :
file not found: ./data/MDBrand.txt
But the file is indeed there. BTW: Each txt file is about 30M. I don't know whether the file size have an affect.
And I'm sure the shiny-server configuration is correct. Because I've run some other apps properly in this shiny-server.
I believe this is happening because of permissioning available to the server (third person/guest) on the folder and file where the file is stored. if you change the guest permission settings on the data folder, it should resolve the issue.
Sarang