The lm function is used to fit linear models in R. It can be used to carry out regression, single stratum analysis of variance and analysis of covariance.