I have just started using R. An example of linear regression looks like this:
lm(y ~ x1 + x2 + x3, data)
It appears that formulas passed to the lm function can contain variable names that are not in scope. How does this work? How is the formula interpreted by R?
I have already tried reading the source code of lm, but couldn't make any sense of it.