Exercises for 2.2: Statistical graphics

Preliminaries

  • load the driving.Rdata file.
  • type head( driving ) to look at the first few observations
  • load the following packages: lsr
load( "~/Work/Research/Rbook/workshop_dsto/datasets/driving.Rdata")
head( driving )
##    id gender age distractor peak.hour errors_time1 errors_time2 rt_time1
## 1 s.1   male  19      radio       yes            7            7      346
## 2 s.2 female  42    toddler        no           15           16      424
## 3 s.3   male  27       none        no           10            7      415
## 4 s.4 female  22      radio       yes            5            1      266
## 5 s.5 female  33       none        no            4            9      302
## 6 s.6 female  35    toddler       yes           15           12      423
##   rt_time2
## 1      636
## 2      787
## 3      580
## 4      459
## 5      513
## 6      767
library(lsr)

Exercise 2.2.1: Scatter plot

  • Draw as scatter plot of age (age) against RT on the first test (rt_time1)
  • Customise the plot: give it a title, x-axis and y-axis labels, and maybe change the marker.

Solution 2.2.1:

plot(
  x = driving$age,
  y = driving$rt_time1,
)