Exercise 1.

Plot the boxplot of highway fuel costs by model (using ggplot2 package).

mpg %>% ggplot(aes(y = model, x = hwy )) + geom_boxplot()

Exercise 2.

Using pipes (%>%) please write the command which will create new variable “difference” that will be just a difference between the fuel costs in the city and highway (cty and hwy) and plot the newly created variable on the histogram.

Exercise 3.

Filter all cars with manufacturer “audi” produced in years up to 2009, having fuel costs in the city (cty) >=20 miles per gallon, then plot their fuel costs (cty) on the histogram.

Exercise 4.

Please check if there is any significant relationship between city miles per gallon and highway miles per gallon variables.

## [1] 0.9559159

Exercise 5.

Please check if there is any significant relationship between number of cylinders and engine displacement (in litres).

ggplot(
  data=mpg,
  aes(group=cyl, y=displ)
) +
  geom_boxplot()

cor(cyl,displ,method="kendall")
## [1] 0.834145

Exercise 6.

Please check if there is any significant relationship between type of transmission and “type” of car. Hint: you may use the “ggstatsplot” package here.

ggplot(data=mpg, aes(y = trans, x = class)) + geom_point()

x <- table(trans, class)
Phi(x)
## [1] 0.7349241