This book is mainly targeted towards R-newbies who have managed to learn some basic R syntax and are looking for some guidance on writing functions in R. The key idea that one needs to understand before writing functions is the way R organizes objects in various environments. The author explains this idea using the analogy of “file system in a computer”. The book uses two examples, 1) shuffling a deck and dealing cards from it 2) simulating the outcomes of a slot machine. The code is extensively annotated so as to make it easy for any reader to thoroughly understand each code fragment. Even though the examples used in the book are very simple, the author manages to cover quite a number of key concepts of the R language.
Here is a suggestion to someone who thinks he/she is too good at R programming : Code up your own slot machine based on the description given in chapter 7. Check the time your code takes to simulate 10 million slot machine payoffs. See if your code does better than the author’s code that takes up just 23 seconds.
For me, the takeaway from this book is the following visual cue useful to remember about R environments :