cobalt icon indicating copy to clipboard operation
cobalt copied to clipboard

Formula fails, I think because f.build() surrounds a quadratic term with backticks

Open BorgeJorge opened this issue 1 year ago • 0 comments

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)

BorgeJorge avatar May 28 '23 04:05 BorgeJorge