Here is my regression model:

options(digits = 4)
fit <- lm(reg_formula(), data = mtcars)
b   <- coef(fit)
summary(fit)

The fitting result is $mpg = r b[1] + r b[2]``r input$x$. Below is a scatter plot with the regression line.

par(mar = c(4, 4, 1, 1))
plot(reg_formula(), data = mtcars, pch = 19, col = "gray")
abline(fit, col = "red", lwd = 2)


rstudio/shinytest2 documentation built on March 29, 2025, 10:58 p.m.