# Comments on “Introduction to Scientific Programming and Simulation Using R”

**Jeromy Anglim's Blog: Psychology, Statistics, & Research Design**, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)

Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

I’ve just been reading *Introduction to Scientific Programming and Simulation Using R* by Owen Jones, Robert Maillardet, and Andrew Robinson.

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`lattice`

plots, you need to`print()`

the plot. - The
`write`

function 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`ncolumns`

argument 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.

**leave a comment**for the author, please follow the link and comment on their blog:

**Jeromy Anglim's Blog: Psychology, Statistics, & Research Design**.

R-bloggers.com offers

**daily e-mail updates**about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.

Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.