library(tidyverse)
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ dplyr 1.1.4 ✔ readr 2.1.6
## ✔ forcats 1.0.1 ✔ stringr 1.6.0
## ✔ ggplot2 4.0.1 ✔ tibble 3.3.1
## ✔ lubridate 1.9.4 ✔ tidyr 1.3.2
## ✔ purrr 1.2.1
## ── 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
Based on the graph, the most popular flue type is r
ggplot(data = mpg) +
geom_bar(mapping = aes(x = fl))
There is differences in fuel economy for vehicles made in 1999 and 2008. The most obvious thing we can tell from the graph is that vehicle that was manufacted in 1999 doesn’t use c and e fuel type. For 2008 cars, they use p fuel type more than 1999 and they barely use d flue type.
ggplot(data = mpg) +
geom_point(mapping = aes(x = fl, y = cty, color =factor(year)), position = "jitter")
This plot is slightly hard to read at first and not that useful but it’s still readable
ggplot(data = mpg) +
geom_point(mapping = aes(x = drv, y = class))