Skip to content
Prev 395337 / 398506 Next

Create a call but evaluate only some elements

You can try either of these:

expr <- bquote(lm(.(as.formula(mod)), dat))
lm_out5 <- eval(expr)

expr <- call("lm", as.formula(mod), as.symbol("dat"))
lm_out6 <- eval(expr)

but bquote is usually easier and good enough.
On Wed, Oct 25, 2023, 05:10 Shu Fai Cheung <shufai.cheung at gmail.com> wrote: