Data Set

This is the updated homework that shows the requested chunk source code for the data using the cars_data.csv data set.

library(readr)

cars_data <- read_csv("cars_data.csv")
## New names:
## Rows: 32 Columns: 12
## ── Column specification
## ──────────────────────────────────────────────────────── Delimiter: "," chr
## (1): ...1 dbl (11): mpg, cyl, disp, hp, drat, wt, qsec, vs, am, gear, carb
## ℹ Use `spec()` to retrieve the full column specification for this data. ℹ
## Specify the column types or set `show_col_types = FALSE` to quiet this message.
## • `` -> `...1`
head(cars_data)
## # A tibble: 6 × 12
##   ...1           mpg   cyl  disp    hp  drat    wt  qsec    vs    am  gear  carb
##   <chr>        <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 Mazda RX4     21       6   160   110  3.9   2.62  16.5     0     1     4     4
## 2 Mazda RX4 W…  21       6   160   110  3.9   2.88  17.0     0     1     4     4
## 3 Datsun 710    22.8     4   108    93  3.85  2.32  18.6     1     1     4     1
## 4 Hornet 4 Dr…  21.4     6   258   110  3.08  3.22  19.4     1     0     3     1
## 5 Hornet Spor…  18.7     8   360   175  3.15  3.44  17.0     0     0     3     2
## 6 Valiant       18.1     6   225   105  2.76  3.46  20.2     1     0     3     1

Mean MPG

mean_mpg <- mean(cars_data$mpg)
mean_mpg
## [1] 20.09062

Minimum MPG

min_mpg <- min(cars_data$mpg)
min_mpg
## [1] 10.4

Maximum MPG

max_mpg <- max(cars_data$mpg)
max_mpg
## [1] 33.9

Number of Cars

num_cars <- length(cars_data$mpg)
num_cars
## [1] 32

Final Answers

The dataset contains 32 cars.
The average MPG is 20.09,
the minimum MPG is 10.4,
and the maximum MPG is 33.9.