# x <- c(1.1, 2.2, 3.3, 4.4, 5.5, 6.6) y <- c(12.21, 14.43, 16.61, 18.83, 21.01, 23.23) #two notations for plotting plot(x,y,main="Y versus x -- using x, y") plot(y ~ x, main="Y versus X -- using y ~ x") correct_fit=lm(y~x) summary(correct_fit) abline(correct_fit, col="Red") wrong_fit=lm(x~y) #mixing up x and y summary(wrong_fit) abline(wrong_fit, col="Blue") #seems like abline doing nothing # I can use curve to plot a function # this is just a made-up function that is in the plot region # add=TRUE means add it to existing plot rather than overwrite it curve(14 + 1.5*x, from=1, to=6, add=TRUE, col="Green")