06_Deploy problem set on shinyapps.io.Rmd
This vignette explains how you can host a problem set directly in the web using shinyapps.io.
The standard installation of RTutor and dependencies uses my own R repositorium.
However, if you want to host problem sets on shinyapps.io, all packages have to be installed from CRAN or directly from Github.
Hence, if you have not done so, follow the corresponding installation instructions on
to reinstall your packages correspondingly.
The RTutor package has a function
rtutor.app.skel that creates a skeleton of your app directory and a file
deployapp.r which contains commands to deploy your app.
Here is an example fore creating an app based on an .rps file:
# Create app based on .rps ps.name = "Example" # problem set name libs = c("foreign", "ggplot2") # list of all libraries used by ps # Folder that contains your .rps file rps.dir = "D:/libraries/RTutor/examples" # Folder in which app shall be created app.dir = "D:/libraries/RTutor/examples/ExampleApp" rtutor.app.skel(ps.name=ps.name, app.name="RTutorExample", app.dir=app.dir, rps.dir = rps.dir, rps.app = TRUE, libs=libs,overwrite=TRUE)
You must just adapt the names and directories in the example above.
It is possible to use the parameter
rtutor.app.skel to change the behavior of the generated problem set.
ps.show.opts = list(show.solution.btn=FALSE) for example transfers sets the option
FALSE just as when using
Providing the parameter
shinyapps.account.info as a list holding the shinyapps.io Account info, i.e.
shinyapps.account.info=list(name = "<SHINYAPPS_USERNAME>", token = "<TOKEN>", secret = "<SECRET>") the created deployapps.R file already holds the desired info - otherwise it has to be changed in deployapps.R to upload.
Now in your app directory, e.g. “D:/libraries/RTutor/examples/ExampleApp” a file
deployapp.r is created. Follow the steps described in this file to deploy your app on shinyapps.io. The file also contains the links that describe how to create a user account on shinyapps.io.