for introducing time periods to your data you are going to want to introduce a new variable , I would lean heavily on the lubridate package for the practical functions, however there is a slight subtlety depending on if you are just wanting 5 minute periods relative to UTC (easy) or from the arbitrary starting point in your data (harder).
For the easy option, you can just use lubridate's floor_date(x, "5 mins") function.
For the harder option, one approach to make sure that you time range is normalised to the same starting point as the floor_date function, by subtracting the difference between the first entry and the midnight preceding it from each entry.
example <- data.frame(x = c(ISOdatetime(2018,10,1,1,2,3, tz="UTC"),ISOdatetime(2018,10,1,14,26,38, tz="UTC")))
example %>% mutate(date_chunk = floor_date(x - (min(x) - ISOdatetime(year(x), month(x), day(x), 0, 0, 0)), "5 mins")
Once you have a variable of what time group you are in there are 2 general strategies for combining filtered summarised data with the full rows of the data:
the commonest strategy would be to work out the summary percentile values for each group (I am guess the upper and lower percentiles), save that data set, then you a database type join operation to stick the summary value to each row of the original data, so you can then compare each row to see if it is in the desired range.
The other approach is more of a set theory one where you imagine adjusting the boundaries of a Venn diagram- one calculates the time groups, then groups the data to the time groups and uses mutate to introduce the summary values to each group. You can then ungroup() or group_by() to different grouping levels in the data.
One trick related to this that might be needed subsequently, depending on approach, is if you want to set all members of a current group to the first member of a group you can go mutate(x2 = rep(x[1], n())) which repeats the first value of x for the entire group.