how to deploy shiny app that uses local data

前端 未结 3 1627
广开言路
广开言路 2020-12-06 07:25

I\'m deploying my shiny app and I don\'t know how to input my a local dataset. I keep getting Error: object \"data\" not found. Here is my path to shiny folder.

相关标签:
3条回答
  • 2020-12-06 07:41

    What I did was to write the csv under a sub folder (i.e. data/) of the shiny app directory and then added data<-read.csv("/Data/proj.csv") in server.r (as indicated in the answer). I didn't put the dot and it works.

    Another thing is, when you publish it, don't forget to publish both the shiny app and the file in the shiny app folder.

    0 讨论(0)
  • 2020-12-06 07:49

    You may want to add a subdirectory in your shiny folder called "Data" and put proj.csv there.

    Then, in your server.r put:

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

    That will make it clear where the data is when the app is deployed to the ShinyApps service.

    0 讨论(0)
  • 2020-12-06 07:59

    I ran into this same problem. It turned out that I did not have my working directory pointing to my shiny app at the time I used shiny.io to save and deploy my app.

    Be sure that if you're loading the data that the code reflects that your shiny app is the working directory.

    Otherwise you will get a log error that looks something like this

    cannot open compressed file 'C:/Users/Joseph/Documents/data/data.rda', probable reason 'No such file or directory'

    0 讨论(0)
提交回复
热议问题