In the following example, on the x-axis how could I add number of observations for each year? For example, instead of 2008, I would like to have *2008 (n = 100)* . Note that n comes from the variable `number_obs`

.

```
suppressWarnings(suppressMessages(library(tidyverse)))
#######
# Data
#######
set.seed(123)
toy_data <- tibble(
year = 2008:2017,
mean = rnorm(10, mean = 50, sd = 20),
median = rnorm(10, mean = 40, sd = 15)
) %>%
pivot_longer(
cols = mean:median,
names_to = "stats",
values_to = "delay"
) %>%
mutate(number_obs = rep(100:109, each = 2))
head(toy_data)
#> # A tibble: 6 x 4
#> year stats delay number_obs
#> <int> <chr> <dbl> <int>
#> 1 2008 mean 38.8 100
#> 2 2008 median 58.4 100
#> 3 2009 mean 45.4 101
#> 4 2009 median 45.4 101
#> 5 2010 mean 81.2 102
#> 6 2010 median 46.0 102
#######
# Plot
######
toy_data %>%
ggplot(aes(x = year, y = delay , color = stats)) +
geom_line() +
geom_point() +
stat_summary(geom = "text", fun = quantile,
aes(label=sprintf("%1.0f", ..y..)),
position = position_nudge (x= -0.25), size=2.5) +
labs(
subtitle = "Yearly Stat",
color = "Statistics",
y = "Delay",
x = "Year"
) +
scale_x_continuous(breaks = 2008:2018) +
theme(text = element_text(size = 8),
axis.text.x = element_text(angle = 90, size = 7))
```

^{Created on 2020-11-17 by the reprex package (v0.3.0)}