Homework
- Create a new Rmarkdown document in a folder with cars_data.csv
- Load cars_data.csv into the Rmarkdown document
Answer these questions in the Rmarkdown document. Show your code:
- What is the average (mean()) mpg for all cars?
- What is the minimum mpg for all cars?
- What is the maximum mpg for all cars?
- 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