I am trying to use R to create a linear model and use that to predict some values. The subject matter is baseball stats. If I do this:
obp <- lm(offense
There is no difference---you get the same coefficients.
But some programming styles are better than others -- and attach is to be avoided, as is the more verbose first form.
Most experienced users do
lm(R ~ OBP, offense)
instead.