It would help me and other people who want to help you if you could post a reproducible example, or "reprex".
It helps me that you posted some data (thanks!), but it didn't come across in a way that people will be able to load directly. Please see below for my attempt at loading it in. Are we now looking at the same data?
library(tidyverse)
data <- tribble(
~"Grains", ~"Result", 10, 5, 37, 5, 83, -2, 115, 5, 55, -2, 98, -2, 156, -2, 39, -2, 98, -2, 50, -2, 74, 5, 19, -2, 13, 5, 78, -2, 74, -2, 75, 5, 27, 5, 49, 5, 16, -2, 83, -2, 5, 5, 156, -2, 32, 5, 24, -2, 68, -2, 40, -2, 45, -2) %>%
arrange(Grains)
data
#> # A tibble: 27 x 2
#> Grains Result
#> <dbl> <dbl>
#> 1 5 5
#> 2 10 5
#> 3 13 5
#> 4 16 -2
#> 5 19 -2
#> 6 24 -2
#> 7 27 5
#> 8 32 5
#> 9 37 5
#> 10 39 -2
#> # ... with 17 more rows
Created on 2018-08-19 by the reprex package (v0.2.0).
I'm not sure I understand your goal. Is it to find a contiguous range of Grains values that collectively have the highest sum of Result? If that's the case, would a good solution identify that the ranges of Grains from [5-13] and [27-37] both have three 5's, and a total sum of 15?