I have been trying to deploy a shiny app using rsconnect: deployapp(appname = "myapp")
. I get the following message at the command prompt:
Application successfully deployed to https://sitename.shinyapps.io/MyApp/
However, when I launch the app, I get the error message:
ERROR: cannot change working directory
Based on resolution to similar problem on both Stackoverflow and googleforum, I tried using both absolute and relative paths in setwd()
. Following are the error messages with both absolute and relative paths to setwd()
:
Error in setwd("~/Data/Projects/MyApp"): cannot change working directory
Error in setwd("C:/Users/Documents/Data/Projects/MyApp"): cannot change working directory
Any suggestions to resolve the issue would be greatly appreciated. thanks in advance!
To deploy your application, use the deployApp command from the rsconnect packages. If you're using the RStudio IDE, you can also deploy your application by clicking the Publish button while viewing the application. Once the deployment finishes, your browser should open automatically to your newly deployed application.
shinyapps.io is a virtualized container service running shiny apps.
C:/
do not make sense in the linux world.~/Data
might not exist. Work with relative paths ~/
Also put a checkguard with dir.exists()
and dir.create
dirname <- '~/Data/Projects/MyApp'
if (!dir.exists(dirname))dir.create(dirname,recursive=TRUE)
FYI I don't really think your should be doing any setwd()
for shinyapps. If the data file is is in ~/Data/Projects/Myapp/somedata.csv
you can do a direct read in the app as read.csv('somedata.csv')
.
The server directory structure is in the form of /srv/shiny-server/MyShinyApp
when you upload
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