Abacus
Abacus

Reputation: 21

Getting an error when trying to publish my shiny app to the server for others to view

My shiny app runs fine in my local environment, however, when I go to publish it online I get the error "An error has occurred. The application failed to start. Contact the author for more information."

When I review the error I get: "Line 36 Paths should be to files within the project directory" "Line 38 Paths should be to files within the project directory"

Here is the code for both of those lines:

36. data <- read_excel("~/data/T Version/Values for R/Pricing 081021.xlsx") %>%filter(Date_of_Indication == max(Date_of_Indication))

38. portfolio <- read_excel("~/data/T Version/Values for R/Portfolio for R 081021.xlsx")

I'm a bit stumped as to why it isn't working, any help would be much appreciated.

Thanks

Upvotes: 2

Views: 3125

Answers (1)

Dylan_Gomes
Dylan_Gomes

Reputation: 2280

The online app doesn't have access to your local directory. You need to either include the data in the code itself with something like dput() or include the URL to the raw data file via GitHub or something similar.

For example, I use code like this to read a csv from my GitHub repository for my online apps:

dat<-read.csv("https://raw.githubusercontent.com/UserName/RepoName/DataInput.csv")

But note that the repo has to be set to be publicly available (not private).

A potentially helpful link: https://shiny.rstudio.com/tutorial/written-tutorial/lesson7/

Upvotes: 1

Related Questions