head(er_visits_age)
## # A tibble: 6 × 6
## year age rate lower95cl upper95cl visits
## <dbl> <chr> <dbl> <dbl> <dbl> <dbl>
## 1 2011 0-4 years 3.52 1.82 6.16 12
## 2 2011 15-34 years 7.34 5.95 8.74 106
## 3 2011 35-64 years 5.84 4.80 6.88 121
## 4 2011 5-14 years 5.20 3.50 6.90 36
## 5 2011 65+ years 8.34 5.98 10.7 48
## 6 2012 0-4 years 3.58 1.85 6.25 12
Notice that age
is a chr
variable. This indicates that the values are character strings.
R does not realize that there is any order related to the AGE
values. It will assume that it is alphanumeric (for numbers, this means ascending order).
However, we know that the order is: 0-4 years old, 5-14 years old, 15-34 years old, 35-64 years old, and 65+ years old.