I am not aware of a library that directly addresses this specific problem. But it can be solved using dplyr
and a few steps:
1. Create the data table
library(dplyr)
data_sample <- tribble(
~ "Data", ~ "Results", 28, -2, 28, -2, 28, 5, 28, -2, 28, -2, 28, -2, 28, -2, 28, 5, 28, -2, 28, 5, 28, -2, 28, -2, 28, -2, 28, -2, 28, -2, 28, -2, 28, -2, 27, 5, 27, 5, 27, -2, 27, 5, 27, 5, 27, 5, 27, 5, 27, 5, 27, -2, 27, -2, 27, -2, 27, 5, 27, 5, 27, 5, 27, -2, 26, 5, 26, -2, 26, 5, 26, -2, 26, -2, 26, 5, 26, -2, 25, -2, 25, -2, 25, -2, 25, 5, 25, -2, 25, 5, 24, -2, 24, -2, 24, -2, 24, 5, 24, 5, 24, -2, 24, 5, 24, 5, 23, -2, 23, 5, 23, -2, 23, -2, 23, -2, 23, -2, 23, -2, 23, -2, 23, -2, 22, -2, 22, -2, 22, 5, 22, -2, 22, -2, 22, -2, 22, -2, 22, -2, 22, -2, 22, -2, 22, -2
)