I would like to draw a straight line on the graph using the following linear equation.
y = 2.522x-1.331
I used the following code to get a scatter plot.
data=read.csv("C://book.csv") plot(data$x,data$y)
You need to use the abline function:
abline
abline(a=-1.331, b=2.522)
Argument a is the hook and argument b slope. See ?abline more details.
a
b
?abline
Use abline for example
abline(-1.331, 2.522)