As @Fernando already mentioned in his comment you could try cut
(binning) and tapply
:
tapply(df$f, cut(df$r, seq(15, 70, by=5)), mean)
# (15,20] (20,25] (25,30] (30,35] (35,40] (40,45] (45,50] (50,55] (55,60] (60,65] (65,70]
#17.68433 18.55918 19.28683 20.49000 20.87942 20.65430 20.96155 21.35146 21.92259 22.57414 21.74700