Atomic R

Programming for Data



Welcome to Atomic R!

#> [1] TRUE

This book is designed for use in STAT 385, Statistical Programming Methods, at the University of Illinois Urbana-Champaign. This book is a work in progress. While it is a work in progress, use this book outside of STAT 385 at your own risk. You may see “TODO” scattered throughout, with some notes to the author. These will help you know what information is still to be added and updated.

Why R?

Truthfully, because the author is a statistician who was trained by statisticians and R is a language written by statisticians for statisticians.

Many who are new to R might wonder: Why not Python? No reason really, except that this is a book about R. Both R and Python are useful languages for interacting with data. If you’d like to learn Python, go for it! Realistically, it would be incredibly useful to learn both R and Python.

Why Base R?

If you have some prior R experience, you might also wonder: Why not start with the tidyverse? If this questions doesn’t mean anything to you, skip the rest of this subsection.

  • TODO:
  • TODO: 枯れた技術の水平思考
  • TODO: Lateral Thinking with Withered Technology
  • TODO: note about tinyverse, data.table, etc
  • TODO: examples: poorman package
  • TODO: base R, and then tidyverse


Source code and its output will be written in a monospaced1 font.

Source code will be displayed with a subtle grey background. For example:

# this is some source code
x = 1:10
y = x + c(1, -1)

Code output will be displayed with a subtle blue background. Additionally, output lines will be prefixed with #>. For example:

#> [1] "This is some output."

Often, output will immediately follow its source.

x = 1:10
y = x + c(1, -1)
x + y
#>  [1]  3  3  7  7 11 11 15 15 19 19

There will usually be some additional hints from R that the output is output, like the [1] seen above. These context clues will become move obvious over time as you progress through the book and learn about how R prints objects.

  1. A monospaced font is a font such that each possible character occupies the same amount of horizontal space on a screen. This is standard practice when coding. This is opposed to a proportional font you might see when typing prose that allows different characters to occupy differing amounts of horizontal space. Monospace fonts may also be referred to as fixed-width fonts.↩︎