Understanding lm and environment
I'm executing lm() with arguments formula , data , na.action , and weights . My weights are stored in a numeric variable. When I specify formula as a character (i.e. formula = "Response~0+." ), I get an error that weights is not of the proper length (even though it is). When I specify formula without the quotes (i.e. formula = Response~0+. ), the function works fine. I stumbled upon this sentence in the lm() documentation: All of weights, subset and offset are evaluated in the same way as variables in formula, that is first in data and then in the environment of formula. This is difficult for