Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
Because of delays with my scholarship payment, if this post is useful to you I kindly ask a minimal donation on Buy Me a Coffee. It shall be used to continue my Open Source efforts. The full explanation is here: A Personal Message from an Open Source Contributor. If you play the electric guitar, the same scholarship chaos led me to turn my guitar pedals and DIY kits hobby into a business, and you can check those here.
I uploaded a Shiny app made with Golem to Shiny Apps for a live demo. I had to troubleshoot a few issues with the deployment so here are the steps I used. I hope this is useful 🙂
After creating a Shiny app skeleton with golem::create_golem("pkgname")
you can create an app such as the 2×2 Cobb-Douglas General Equilibrium viewer (code on [GitHub(https://github.com/pachadotdev/cobbdouglasge]).
When I tried to deploy that Cobb-Douglas app to ShinyApps.io I got this message:
> rsconnect::deployApp() ℹ Capturing R dependencies The following package(s) were installed from an unknown source: - cobbdouglasge [0.0.0.9000] renv may be unable to restore these packages in the future. Consider reinstalling these packages from a known source (e.g. CRAN). Error in renv_snapshot_validate_report(valid, prompt, force) : aborting snapshot due to pre-flight validation failure
The cause of the problem is that when testing my app, I installed it locally with devtools::install()
, and ShinyApps needs CRAN or GitHub as a source for the dependencies.
To remedy that, I added the following to dev/03_deploy.R
without running it:
golem::add_shinyappsio_file() remotes::install_github("pachadotdev/cobbdouglasge") use_git_ignore("rsconnect/") rsconnect::deployApp()
I know pak
is the standard these days, but it gave me a compilation error when I tried to install it, so I used remotes
.
As an optional step to save space in my ShinyApps account, I created the file .rscignore
containing:
.here CODE_OF_CONDUCT.md LICENSE* NEWS* README* dev man vignettes tests
Then I ran the previous chunk that allowed me to deploy the Cobb-Douglas app without errors.
R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.