Your second script

Our second R script is a simple two variable regression model which predicts women’s height based upon weight.

Begin by creating another R script by selecting  File | New File | R Script from the top navigation bar. If you create new scripts via FileNew FileR Script often enough you might get Click Fatigue (uses three clicks), so you can also save a click by selecting the icon in the top left with the + sign:

Whichever way you choose , a new blank script window will appear with the name Untitled2.

Now paste the following code into the new script window:

require(graphics)
data(women)
lm_output <- lm(women$height ~ women$weight)
summary(lm_output)
prediction <- predict(lm_output)
error <- women$height-prediction
plot(women$height,error)

Press the Source icon to run the entire code. The display will change to something similar to what is displayed as follows: