Chapter 14 6. Practice Question: Summarize Titanic Titles

Create a summary table showing the number of passengers in each title group.

title_summary <- titanic %>%
  count(Title, sort = TRUE)

title_summary
## # A tibble: 17 x 2
##    Title            n
##    <chr>        <int>
##  1 Mr             517
##  2 Miss           182
##  3 Mrs            125
##  4 Master          40
##  5 Dr               7
##  6 Rev              6
##  7 Col              2
##  8 Major            2
##  9 Mlle             2
## 10 Capt             1
## 11 Don              1
## 12 Jonkheer         1
## 13 Lady             1
## 14 Mme              1
## 15 Ms               1
## 16 Sir              1
## 17 the Countess     1

14.1 6.1 Plot Titanic Titles

title_summary %>%
  ggplot(aes(x = reorder(Title, n), y = n)) +
  geom_col() +
  coord_flip() +
  labs(
    title = "Number of Titanic Passengers by Title",
    x = "Title",
    y = "Number of Passengers"
  )