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.
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, a .csv called proj.csv
.
In the server.R
file,
I set data<-read.csv("proj.csv")
I just don't know how to get Shiny to pick up my datasets.
You might be eager to deploy your Shiny app to a remote server. But the simplest way to run a Shiny app is to run it locally. You only need the shiny R package installed, and you can run the app in your browser.
Your title asks about importing a data frame into shiny. That can be done by storing the data frame either as a binary file using the save() function or a csv file using write. csv() and having the shiny app read it in using load() for a binary file or read. csv() for a csv file.
Your application may be dependent on packages that are installed and loaded in your environment, but aren't installed for the correct user on the Shiny Server. Make sure that all necessary packages are installed for the same user set under run_as in your Shiny Server configuration file.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With