Homework

  1. Create a new Rmarkdown document in a folder with cars_data.csv
  2. Load cars_data.csv into the Rmarkdown document

Answer these questions in the Rmarkdown document. Show your code:

  1. What is the average (mean()) mpg for all cars?
  2. What is the minimum mpg for all cars?
  3. What is the maximum mpg for all cars?
  4. How many cars are there in the dataset? (Hint: length() of mpg)
cars_data<-read.csv("cars_data.csv") 
mean(cars_data$mpg)
## [1] 20.09062
min(cars_data$mpg)
## [1] 10.4
max(cars_data$mpg)
## [1] 33.9
length(cars_data$X)
## [1] 32