Djessi Jorge
31 July 2026
Vehicle comparisons involve several linked characteristics. A heavier or more powerful car may offer different performance, but it may also use more fuel. Static tables make those trade-offs harder to explore.
The application gives learners and analysts a simple way to:
The application uses the built-in mtcars dataset, so it is reproducible
without downloading an external file.
data(mtcars)
c(
vehicles = nrow(mtcars),
variables = ncol(mtcars),
average_mpg = round(mean(mtcars$mpg), 1),
mpg_range = paste(range(mtcars$mpg), collapse = " to ")
)
vehicles variables average_mpg mpg_range
"32" "11" "20.1" "10.4 to 33.9"
Each widget change triggers a reactive filter. The summary cards, plot and vehicle table are recalculated from the same filtered records.
The MPG predictor fits a transparent multiple linear regression:
mpg_model <- lm(mpg ~ wt + hp + factor(am), data = mtcars)
round(c(
adjusted_R_squared = summary(mpg_model)$adj.r.squared,
residual_SE = summary(mpg_model)$sigma
), 3)
adjusted_R_squared residual_SE
0.823 2.538
The user selects weight, horsepower and transmission. Shiny passes those
inputs to predict(), displays the estimated MPG and plots it beside the
observed vehicles. The result is illustrative because mtcars is a small,
historical dataset.
Use the application to move from a broad vehicle list to an evidence-based, interactive comparison in seconds.