← R Programming learning pathR Programming · Module 8 of 10
Regression and modelling
Build linear and logistic models.
📖 Key ideas
- lm(salary ~ experience, data = df) fits a linear regression.
- summary(model) shows coefficients and R-squared.
- predict(model, newdata) makes predictions.
- glm(..., family = binomial) fits logistic regression.
- tidymodels and caret offer full ML workflows.
💡 Real-life example: Regression draws the best straight road through scattered houses (data points).
lm()Linear model
R-squaredShare of variation explained
glm()Generalised linear model
predict()Makes predictions