Graphs in R / Basic Plot function – linear model

Basic Plot – linear model with abline()

Plot 1 – linear model all datapoints

 

Plot 2 – linear model per subset

Add library(graphics) to the code for the legend() function

Use of lapply –> take the vector mtcars$cyl and apply the abline() function. Within abline() the linear model is calculated per subset of cyl (cylinders)

 

Graphs in R / Basic Plot function – linear model
Tagged on: