How to deploy a brilliant application using local data

I am deploying my brilliant application and I do not know how to enter my local dataset. I keep getting Error: object "data" not found . Here is my path to the shiny folder.

 library(shinyapps) shinyapps::deployApp('C:\\Users\\Jeremy\\Desktop\\jerm2') 

In this directory (jerm2) I have 3 things: ui.R , server.R and my local dataset. CSV is called proj.csv .

In the server.R file server.R I set data<-read.csv("proj.csv")

I just don't know how to get Shiny to pick up my datasets.

+4
source share
3 answers

You can add a subdirectory to your shiny folder called "Data" and place proj.csv there.

Then in server.r put:

 data<-read.csv("./Data/proj.csv") 

This will help you understand where the data is when the application is deployed to ShinyApps.

+9
source

I ran into this problem. It turned out that I did not have a working directory pointing to my brilliant application when I used shiny.io to save and deploy my application.

Make sure that if you download data that reflects the code, then your brilliant application is the working directory.

Otherwise, you get a log error that looks something like this:

cannot open the compressed file "C: /Users/Joseph/Documents/data/data.rda", the probable cause is "There is no such file or directory"

+2
source

What I did was write csv under a subfolder (i.e. data /) from the brilliant application directory, and then add data<-read.csv("/Data/proj.csv") to server.r (as indicated in answer). I did not put an end to it, and it works.

Another thing, when you publish it, do not forget to publish both the brilliant application and the file in the brilliant application folder.

0
source

Source: https://habr.com/ru/post/986295/


All Articles