How to get residual in linear regression model in R

linear_regression
r

#1

I am currently working on linear regression problem
data(airquality)
names(airquality)
plot(Ozone~Solar.R,data=airquality)
mean.Ozone=mean(airquality$Ozone,na.rm=T)
abline(h=mean.Ozone)
model1<-lm(Ozone~Solar.R,data=airquality)
abline(model1,col=“red”)
now I want to know how I can get the residual and how I can display in the plot


#2

@hinduja1234- you can use the command plot to plot the model1 and then you get the plot in which you can clearly see residual.

Hope this helps!
Regards,
Harry