1.16 pivot_longer()

glimpse(table4a)
## Rows: 3
## Columns: 3
## $ country <chr> "Afghanistan", "Brazil", "China"
## $ `1999`  <dbl> 745, 37737, 212258
## $ `2000`  <dbl> 2666, 80488, 213766
table4a %>%
  pivot_longer(c(`1999`, `2000`), names_to = "year", values_to = "cases")
## # A tibble: 6 × 3
##   country     year   cases
##   <chr>       <chr>  <dbl>
## 1 Afghanistan 1999     745
## 2 Afghanistan 2000    2666
## 3 Brazil      1999   37737
## 4 Brazil      2000   80488
## 5 China       1999  212258
## 6 China       2000  213766