After a period of examinations I needed to fresh up some R-vocabulary (the exact syntax) because I started to mix it up with other programming languages’ syntax. And here is my result: A dice game simulation. Not very innovative, not very difficult, but I suppose it could be quite useful for people being new to R as an easy example of how programming in R may work. Furthermore, it is an application of the nice rpanel package.
For this program being very simple I skipped most comments on the code – but will add some more in the near future. The variables should be quite self-explaining. If not, feel free to write a comment. Of course more experienced programmers are welcomed to improve the code. 🙂
Usage: Run the code in R, use the sliders of the panel to choose the number of dice to throw, the number of throws and hit the Throw! button.
This small program enables you to investigate or illustrate, respectively, some aspects of convergence or simply to get a feeling for your chances to win your next dice game. Feel free to use the program for didactical purposes if you find it useful (see the license in the footer of this page). If you want to have reproducable results set a random number seed of your choice by using the set.seed() function implemented in R.