plot(cost ~ number, data = Family)
abline(lm(cost ~ number, data = Family), col = "red")
cor(Family$cost, Family$number)
if (FALSE) {
library(ggplot2)
ggplot2::ggplot(data = Family, aes(x = number, y = cost)) +
geom_point() +
geom_smooth(method = "lm") +
theme_bw()
}
Run the code above in your browser using DataLab