Statistical Analysis: an Introduction using R/R/A simple R session

Even though R has not been fully introduced yet, it is instructive to see how simple a useful R session can be. As an example, we will fit a statistical model using the cars data from the previous topic, and see how to produce a similar plot to Figure 1.2b, with a straight best-fit line. This is a common task in many simple analyses.

Some of the commands in this example will be unfamiliar: don't worry, the main point is not to understand the commands, but to get an overall sense of how R works. Nevertheless, if you do want to understand the commands fully, you will need to know about data frames (essentially, tables of data with named columns) and model formulae (essentially, a notation of the form, meaning a is predicted by b and c).