February 10, 2017

(This article was first published on R and Finance, and kindly contributed to R-bloggers)

Serving book exercises in the web with Shiny and Exams –

As you may know, I recently published a R book in amazon.
I decided to keep R exercises out of the book and serve them freely over the web. This was not a difficult decision since I’m still writing and revising all questions. My experience tell me that good exercises requires time to develop and I didn’t want to rush it just for the sake of publishing the book.

I’m a big fan of package Exams and, given that I already have some questions about R in this format, I should use it to build the exercises for my book. The reader is better served than using a single version format as he/she can rebuild a different set of exercises each time, and take the same set of exercises over and over, if needed. The problem is that building a new exam in package Exams requires R and latex compilation. I could compile in my computer and provide pdf files of different versions in the website, but this is not really an elegant solution.

With that in mind, I was able to write a shiny app that distributes pdf files in the internet. I customized all templates so that they fit my needs. I have never seen anything like that, which is why I am posting it here. I’m still amazed of how much a few lines of code in Shiny can do.

The users can choose the chapter and the language. After clicking the “build” button, a custom call to exams2pdf is made and the user can download a zip file with the contents of the exercises.

Give it a try here.

Curious about the code? All files are available in github.

To leave a comment for the author, please follow the link and comment on their blog: R and Finance. offers daily e-mail updates about R news and tutorials on topics such as: Data science, Big Data, R jobs, visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...

If you got this far, why not subscribe for updates from the site? Choose your flavor: e-mail, twitter, RSS, or facebook...

Comments are closed.

Search R-bloggers


Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)