---
title: "Data Review"
author: "Chethan J P"
date: "2026-05-31"
output: html_document
---
# Load Data
``` r
# Example dataset (replace with your own CSV or Excel file)
data(mtcars)
dat <- as_tibble(mtcars)
# Preview first few rows
head(dat)
```
```
## # A tibble: 6 × 11
## mpg cyl disp hp drat wt qsec vs am gear carb
## <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 21 6 160 110 3.9 2.62 16.5 0 1 4 4
## 2 21 6 160 110 3.9 2.88 17.0 0 1 4 4
## 3 22.8 4 108 93 3.85 2.32 18.6 1 1 4 1
## 4 21.4 6 258 110 3.08 3.22 19.4 1 0 3 1
## 5 18.7 8 360 175 3.15 3.44 17.0 0 0 3 2
## 6 18.1 6 225 105 2.76 3.46 20.2 1 0 3 1
```
# Figure 1: Scatterplot of Weight vs MPG
``` r
fig_dat1 <- dat %>%
select(wt, mpg)
ggplot(fig_dat1, aes(x = wt, y = mpg)) +
geom_point(color = "steelblue") +
labs(
title = "Scatterplot of Weight vs MPG",
x = "Weight (1000 lbs)",
y = "Miles per Gallon"
)
```
<img src="report_files/figure-html/unnamed-chunk-2-1.png" alt="" width="672" />
# Figure 2: Boxplots of MPG, Horsepower, and Weight
``` r
fig_dat2 <- dat %>%
select(mpg, hp, wt)
dat_long <- fig_dat2 %>%
pivot_longer(
cols = everything(),
names_to = "Variable",
values_to = "Value"
)
ggplot(dat_long, aes(x = Variable, y = Value, fill = Variable)) +
geom_boxplot() +
labs(
title = "Boxplots of MPG, Horsepower, and Weight",
x = "Variable",
y = "Value"
)
```
<img src="report_files/figure-html/unnamed-chunk-3-1.png" alt="" width="672" />
# Figure 3: Density Plot of Quarter Mile Time
``` r
fig_dat3 <- dat %>%
filter(cyl == 6) %>%
select(qsec)
ggplot(fig_dat3, aes(x = qsec)) +
geom_density(fill = "lightgreen", alpha = 0.6) +
labs(
title = "Density Plot of Quarter Mile Time (6-Cylinder Cars)",
x = "Quarter Mile Time (sec)",
y = "Density"
)
```
<img src="report_files/figure-html/unnamed-chunk-4-1.png" alt="" width="672" />