Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Shiny/R error: Paths should be to files within the project directory

Tags:

r

csv

shiny

My Shiny app will run locally, but when I try to deploy to shinyapps.io it will not. I temporarily fixed the problem by removing the 'dot' in the path to the .csv file:

data <- read.csv("/Users/JMJC/Desktop/bbteams-shiny/bbteams.csv")

But when it deployed to shinyapps.io I received a different error, ERROR: cannot open the connection.

shinyapps::deployApp('/Users/JMJC/Desktop/bbteams-shiny')

I placed my data set in the same directory as server.r and ui.r. And I made sure to setwd() to the same directory.

I'm out of ideas. If I don't remove the dot it will not deploy, but if I do remove the dot it cannot make the connection. If I force it to deploy, it still will not make the connection.

like image 718
conv3d Avatar asked Oct 10 '15 09:10

conv3d


2 Answers

As @DieterMenne already stated in the answer section: Simple solution:

read.csv("bbteams.csv")

Useful link for this and other issues:

https://support.rstudio.com/hc/en-us/articles/229848967-Why-does-my-app-work-locally-but-not-on-shinyapps-io-

like image 50
Pedrinho Avatar answered Sep 24 '22 11:09

Pedrinho


Make sure the path you give for the data file and the path for you R files is the same. So you do not need to mention the whole path, in your case data <- read.csv("/Users/JMJC/Desktop/bbteams-shiny/bbteams.csv") instead just use read.csv("bbteams.csv")

like image 30
HellYeah Avatar answered Sep 26 '22 11:09

HellYeah