This Shiny app predicts miles per gallon (MPG) for cars using the built-in mtcars dataset. Users select horsepower and weight, and the app estimates MPG.
This Shiny app predicts miles per gallon (MPG) for cars using the built-in mtcars dataset. Users select horsepower and weight, and the app estimates MPG.
model <- lm(mpg ~ hp + wt, data = mtcars) predict(model, newdata = data.frame(hp = 100, wt = 2.5))
Result: Predicted MPG is displayed below the input widgets.