linear model

Graphs in R / Basic Plot vs ggplot2

Basic Plot with lm()

  ggplot2 with geom_smooth() method lm

In ggplot the lm() is being composed within the geom_smooth() element, and choosing “lm” (linear model).  

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