Welcome to the Presentation for the MTCARS MPG Predictor App
2025-03-25
Welcome to the Presentation for the MTCARS MPG Predictor App
This application uses the ‘mtcars’ dataset to predict the miles per gallon (mpg) based on the car weight (wt) using a linear regression model.
It offers real-time predictions and is designed for user friendliness.
Below is an example predicting mpg for a car weight of 3.0 (in 1000 lbs).
This R code chunk runs during slide rendering.
# Build the linear regression model using the mtcars dataset linearModel <- lm(mpg ~ wt, data = mtcars) # Predict mpg for a weight of 3.0 predicted_value <- predict(linearModel, newdata = data.frame(wt = 3.0)) predicted_value
## 1 ## 21.25171
The MTCARS MPG Predictor demonstrates Shiny’s reactive programming by providing immediate feedback.
Thank you for your attention!