I am a C# developer, new to R, trying to understand the code line
fit <- lm(quality ~ .,wine)
I get that this creates a list called fit and that
quality ~ .
must somehow instantiate an object of class "formula" for use within the lm function.
from typing
help("~")
into the R Studio Console, I see that
Tilde is used to separate the left- and right-hand sides in a model formula.
Usage y ~ model
Arguments y, model symbolic expressions.
Details The left-hand side is optional, and one-sided formulae are used in some contexts.A formula has mode call. It can be subsetted by [[: the components are ~, the left-hand side (if present) and the right-hand side in that order.
But I am not told what the left and right sides in a model formula are.
What does the following mean?
quality ~ .
What is meant by
the left and right hand sides
of a model formula?