How do I publish a ShinyApp?

Configuring ShinyApps Account on RStudio

First, we need to install and load the rsconnect package.

install.packages('rsconnect')
library('rsconnect')

Once you login to shinyapps.io, navigate to the token page.

Token Example

Then, we can access our own personal token, which we need to link to our RStudio session, by clicking show, show secret, and copying and pasting the command into RStudio.

Secret Command

The command should take the form as follows:

rsconnect::setAccountInfo(name='imlab',
			  token=<token>,
			  secret=<secret>)

At this point, if you have access to deploy the app, you can deploy it onto shinyapps.io with the command:

deployApp(appName='yourAppName')

If you are experiencing errors with the app deployment, deleting the app’s manifest.json may help resolve errors.

Reuse

Text and figures are licensed under Creative Commons Attribution CC BY 4.0. The source code is licensed under MIT.

Suggest changes

If you find any mistakes (including typos) or want to suggest changes, please feel free to edit the source file of this page on Github and create a pull request.

Citation

For attribution, please cite this work as

Ethan Tai (2022). Publishing a ShinyApp. ImLab Notes. /post/2022/03/07/publishing-a-shinyapp/

BibTeX citation

@misc{
  title = "Publishing a ShinyApp",
  author = "Ethan Tai",
  year = "2022",
  journal = "ImLab Notes",
  note = "/post/2022/03/07/publishing-a-shinyapp/"
}