It seems like it would make a good introductory book for a course on, as the title suggests, scientific programming. It provides an introduction to computer programming concepts and how to use R. It then goes on to discuss "numerical techniques", "probability and statistics", and "simulation". It has end of chapter exercises and a package on CRAN (spuRs). It even has an example from the AFL. My guess is that one of the authors is a Richmond supporter.
I've read a lot of R books and I'm always on the look out for some useful suggestions. The following are an assortment of random little tips that I took away from the first few chapters of the book:
sessionInfo()displays attached packages.
- I knew that
pdf(); ...plot code...; dev.off()could be used to save a plot to a pdf file. I didn't know that in order to save
latticeplots, you need to
writefunction converts data to vectors and defaults to one column per element for character code and five for numeric. I now understand that if I want to produce a matrix with write, I need to align the
ncolumnsargument with the number of columns in the matrix.
list(); unlist(); lapply(); sapply()provide some cool options for working with objects in R.
stop("Reason for stopping")can be used to end a function call with a warning message.
system.time(expression)is a good way to examine the time taken by a function or set of expressions.