Shiny Tutorial
This shiny tutorial uses {learnr} package to create an interactive tutorial. The tutorial is designed to help you learn the basics of shiny within a shiny application.
Getting started
- Clone this repository and open the
shiny-tutorial.Rproj
file in RStudio. - To install all necessary packages, run the following command in R:
paks <- c("learnr", "rmarkdown", "DT")
install.packages(paks)
- Open the
shiny_tutorial/shiny_tutorial.Rmd
- Execute the shiny tutorial using the button
Run the document
- Follow the steps and complete the exercises
Run the tutorial alongside your shiny project
To be able to develop a shiny application alongside an active shiny tutorial, 2 options are available:
- run the tutorial in the background locally
- run the tutorial on binder
Run the tutorial in the background locally
You need to follow some extra-steps:
- Stop and close any previous shiny tutorial that is running
- Create a new shiny project within RStudio
File -> New File -> Shiny Web App -> Multiple File
- In the newly created shiny project, go to
Background jobs
tab and click onStart background job
to create a new background job - Select
run_in_background.R
R script on clicking theBrowse
button - Select the
shiny-tutorial
folder as the working directory on clicking theBrowse
button - Click on
Start Job
to run the shiny tutorial in the background - Copy the returned URL mentioned after
Listening on
string corresponding to this patternhttp://127.0.0.1:<port_number>
- Paste the URL in a new window browser to start the tutorial
- Follow the steps and complete the exercises
- if you had already begun the tutorial, you can continue from where you left off (learnr keeps track of your progress)
- you may want to start over the tutorial if so click on
Start Over
button in the sidebar (caution
: it will reset all your progress in the tutorial)
- Continue working within the current shiny project
Run the tutorial on binder
Click on the following badge to run the tutorial on binder, it will open a new tab in your browser and you can start the tutorial from there:
Be patient, it could take a while to deploy the tutorial code on mybinder.org.