Summing certain parts of columns in R studio

Hi, for a reproducible example instead of a screenshot:

For grouping and summarising:

Summarise each group down to one row — summarise • dplyr (tidyverse.org)