R Instructions: Scatterplot

To open R with the dataset preloaded, right-click here and choose "Save Target As" to download the file to your computer. Then find the downloaded file and double-click it to open it in R.

The data have been loaded into the data frame h. Enter the command h to see the data. There are three variables in h: gender, height, and weight.

The variables are identified as follows:

gender: 0 = male, 1 = female.

height: in inches.

weight: in pounds.

First we will create a scatterplot to examine how weight is related to height, ignoring gender.

To do that in R, copy the following command to R:

plot(h$height,h$weight)

Again, a good graphic should have labels so lets add x and y-axis labels:

plot(h$height,h$weight, xlab="Height (inches)", ylab="Weight (lbs)")