Local data preventing application from loading on shinyapps.io

hello, I am trying to publish a Shiny app that I just created using a local data file from my Mac computer. When I publish the app, the app does not work on shinyapps.io because it says that it could not locate the (data) file/could not open the connection. I have tried all sorts of ways of making sure the working directory I am working with matches the directory of where both the R script and the data file is stored, but it still does not work. I would appreciate any help with this ASAP. Thank you!

Is your data file in the same folder as your app.R file? are you using a relative path to your data file? (e.g. ~/data.csv)

It's hard to help you any further without seen any code, could you ask this with a minimal REPRoducible EXample (reprex)? A reprex makes it much easier for others to understand your issue and figure out how to help.

2 Likes

Technically ~/data.csv is not a relative path as ~ is expanded to an absolute path.

All data files should be located in the directory tree containing the application to be deployed, and when deploying have its checkbox checked for files to include in the bundle.

If you are still having issues, please include at least the snippet of code that references the file you are having issues loading and the logs from your application indicating the error.

1 Like

Thank you! I made sure that the files were in the same directory and that I was using relative paths. Thanks again. I also divided the "ui" and "server" as two different files (and selected the multiple file shiny script option from the R dropdown menu) and made sure that the directory was written on both files. I also "deployed" the data file in addition to the two R scripts. All this made it work!

If your question's been answered (even by you!), would you mind choosing a solution? It helps other people see which questions still need help, or find solutions if they have similar problems. Here’s how to do it:

Sure, will do. Thanks.

Thank you! I made sure that the files were in the same directory and that I was using relative paths. Thanks again. I also divided the "ui" and "server" as two different files (and selected the multiple file shiny script option from the R dropdown menu) and made sure that the directory was written on both files. I also "deployed" the data file in addition to the two R scripts. All this made it work!

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.