The string formula in the loop throws an error with standardize(), whereas the non-loop versions do not. Environment issue?
library(arm)
set.seed(1)
A solution is to not use string formulas, but rather to construct a formula from an expression, and evaluate that:
f = eval(bquote(y ~ .(as.name(i))))
This works because f will be constructed in the current environment.
Alternatively, just call as.formula(f) manually instead of passing the naked f to lm; however, I always dislike going the detour via strings. This is an anti-pattern known as stringly typing.