R code with simple linear regressions