#Step 1 Load packages
library(tidyverse)
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ dplyr 1.2.1 ✔ readr 2.2.0
## ✔ forcats 1.0.1 ✔ stringr 1.6.0
## ✔ ggplot2 4.0.3 ✔ tibble 3.3.1
## ✔ lubridate 1.9.5 ✔ tidyr 1.3.2
## ✔ purrr 1.2.2
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag() masks stats::lag()
## ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
library(readxl)
library(readr)
#Step 2 Set Working Directory (Use the Session Dropdown at the top)
setwd("~/Desktop/My class stuff/Tuesday Class")
#Step 3 Load in Datasets
cars_data_2_ <- read_csv("cars_data (2).csv") #Use Import in File window to the Right
## 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`
#Step 3 Answer Homework Questions 1 thru 4
#Question 1 Mean of MPG
mean(cars_data_2_$mpg)
## [1] 20.09062
#Question 2 What is the mimimum MPG for all cars
min(cars_data_2_$mpg)
## [1] 10.4
#Question 3 What is the maximum MPG for all cars
max(cars_data_2_$mpg)
## [1] 33.9
#Question 4 How many cars are in the dataset?
length(cars_data_2_$mpg)
## [1] 32