cobalt
cobalt copied to clipboard
Formula fails, I think because f.build() surrounds a quadratic term with backticks
form1 below won't work with lm() but form2 will. I think the problem is the backticks surrounding the quadratic term in form1.
data(mtcars)
form1 <- f.build('mpg', c('wt', 'I(wt^2)'))
lm(form1, data = mtcars)
form2 <- update(f.build('mpg', 'wt'), ~ . + I(wt^2))
lm(form2, data = mtcars)