I need to create a function that calculates the average of the next 15 rows if the date is equal to day 02.
How can I do this using R's dplyr mutate? In Excel I have:

In R I tryed:
library(dplyr)
ex_dataset <- read.csv( file = "https://raw.githubusercontent.com/rhozon/datasets/master/example_dataset.csv", header = TRUE, sep = ";")
glimpse(ex_dataset)
ex_dataset <- ex_dataset %>%
mutate(
metric = case_when(
date == day(date) == 2 ~ rollapply(residual, 15, mean)
)
)
How can I fix this ? I tryed slice function but, I didn´t had success.