aggregate column data bay step

Hi wamal85, welcome to RStudio Community.

I think the floor() function could help here.

library(dplyr, warn.conflicts = FALSE)
#> Warning: package 'dplyr' was built under R version 4.0.4

df <- tibble(latitude = c(24.02, 24.03, 24.5, 25.0, 25.03, 25.3),
             sardine = c(222, 631, 101, 234, 5249, 300))

df %>% 
  group_by(latitude_floor = floor(latitude)) %>% 
  summarise(sardine_total = sum(sardine))
#> # A tibble: 2 x 2
#>   latitude_floor sardine_total
#>            <dbl>         <dbl>
#> 1             24           954
#> 2             25          5783

Created on 2021-03-17 by the reprex package (v1.0.0)

In future, it would be nice if you provide copy-and-paste-friendly data by preparing a reprex. Please read the guide below for a tutorial on how to do so.