 
 If you do not wish to mess around specifying headings for your scatterplot, the instruction plot(X,Y) would work equally well. R would simply use the variable names (in this case X and Y) for the axis headings.
We have called the heading variables main, xlab and ylab entirely for clarity and convenience, we could have equally well have named them x, y, and m  or indeed anything else that was convenient and recognised by R.
If you only want to specify the headings for a single plot there is no need to create variables for them. For example plot(X, Y, main='Scatterplot of data with linear relationship', xlab='Xvariable', ylab='Yvariable')
Notice that headings must be supplied as charactertype variables  in other words, when assigned, their contents must be enclosed in inverted commas (for example 'X=' or "X=").
 Notice that the instruction n=length(X) assumes variables X and Y contain are of equal length, and none of their data are missing (or not available, NA).
 The function abline can accept information in several distinct ways. For example:
abline(A,B) assumes variable B provides the line's slope, and variable A where that line crosses the Yaxis. In other words Y=A+BX. Thus abline(0,1) is equivalent to saying X=Y.
abline(h=mean(Y)) would add a horizontal line to the plot, equal to the mean of Y.
abline(v=X, col='red') would add red vertical lines, equal to every value of variable X  though why you should wish to do that is entirely another matter.
