Preface

These lecture notes were written by me to accompany John Verzani’s Using R for Introductory Statistics (2nd ed.), to be delivered in lectures teaching students how to program with R in the programming lab accompanying a lecture section focusing on the statistical methods themselves. This is for the second semester of a two-semester statistics course, so knowledge of basic statistical procedures (\(t\)-test, \(t\) confidence intervals for the mean, etc.) and basic R usage (creating variables, writing basic functions, working with lists and data frames, etc.) are assumed.

These notes are not intended to stand alone; I like Verzani’s book and I believe that these notes should supplement it, not replace it. For those taking the programming lab for the University of Utah’s Mathematics Department statistics courses, I would insist on reading Verzani’s book in addition to these lecture notes. However, these notes could serve as a light weight introduction to R and statistical programming.

I hope that you find these notes useful, and wish you the best of luck.

Curtis Miller


  1. When on a single line, the braces {} are actually optional, but I recommend always using them for style purposes; your code is more robust and easily changed if you always use braces.↩︎

  2. The above code could be quickly written and vastly improved like so: stat <- get("mean"); stat(x). Try it! What just happened? What does get() do? Without using get() or a string, we could similarly try stat <- mean; stat(x). Either solution is probably better than using switch(), though.↩︎

  3. Actually many programs consist of loops that basically never end. Video games and graphical programs, for example, are understood as operating in a loop that will not terminate until the whole program terminates.↩︎