You can also do it with modulo and integer division.
For example, for Fridays, check the following:
library(lubridate)
next_friday <- function(dates) {
dates + days((5 - wday(dates) %% 6) + (wday(dates) %/% 6))
}
So for example:
> dates <- sample(seq(ymd('2020-01-01'),ymd('2021-01-01'), by='days'), 20)
> dates
[1] "2020-06-28" "2020-03-22" "2020-07-15" "2020-01-16" "2020-08-01" "2020-05-16" "2020-10-20" "2020-11-03"
[9] "2020-08-25" "2020-10-07" "2020-04-18" "2020-12-11" "2020-05-20" "2020-08-09" "2020-01-10" "2020-05-21"
[17] "2020-10-24" "2020-03-06" "2020-05-19" "2020-09-08"
> next_friday(dates)
[1] "2020-07-02" "2020-03-26" "2020-07-16" "2020-01-16" "2020-08-06" "2020-05-21" "2020-10-22" "2020-11-05"
[9] "2020-08-27" "2020-10-08" "2020-04-23" "2020-12-17" "2020-05-21" "2020-08-13" "2020-01-16" "2020-05-21"
[17] "2020-10-29" "2020-03-12" "2020-05-21" "2020-09-10"
> wday(next_friday(dates))
[1] 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5