Load the data from Table 1 in Section 4.1 into R.

Table1 <- read.csv("https://sullystats.github.io/Statistics6e/Data/Chapter4/Table1.csv")
head(Table1,n=4)
##   Speed Distance
## 1   100      257
## 2   102      264
## 3   103      274
## 4   101      266

Rather than reading the data from Github, we could manually enter the data into R.

Table1a=data.frame("Speed"=c(100, 102, 103, 101, 105, 100, 99, 105), "Distance"=c(257, 264, 274, 266, 277, 263, 258, 275))

Base R

To create a scatter diagram in base R, use the plot( ) command. The syntax for the plot command is

plot(table$x-variable, table$y-variable)

plot(Table1$Speed, Table1$Distance, xlab = "Club Speed (mph)", ylab = "Distance (yards)", main = "Driving Distance vs. Club-head Speed")

Mosaic

install.packages("Mosaic")

To create a scatter diagram in Mosaic, use the xyplot command. The syntax for the command is:

xyplot(y-variable ~ x-variable, data = df_name)

library(mosaic)
xyplot(Distance ~ Speed,data=Table1,main="Driving Distance versus Club-Head Speed",xlab="Club-Head Speed (mph)", ylab="Distance (yards)")