Load the dataset from the Excel file

Displaying the first few rows of the dataset to understand its structure

df$Mass <- as.numeric(df$Mass)
## Warning: NAs introduced by coercion
print(head(df))
## # A tibble: 6 × 6
##   Month  Plot Quadrant  Ring  Mass Comment
##   <chr> <dbl>    <dbl> <dbl> <dbl> <lgl>  
## 1 May     901        1     1  5.35 NA     
## 2 May     901        1     9  1.17 NA     
## 3 May     901        2     1  6.43 NA     
## 4 May     901        2     7 NA    NA     
## 5 May     901        3     1  7.75 NA     
## 6 May     901        3     3  4.11 NA

Based off of the’Month’, ‘Plot’ and ‘Mass’ columns of the DF

cumulative_summary <- df %>%
  group_by(Month,Plot) %>%
  summarise(
    Total_Mass = sum(Mass, na.rm=TRUE), 
    Cumulative_Mass = cumsum(Total_Mass))
## `summarise()` has grouped output by 'Month'. You can override using the
## `.groups` argument.

Display the cumulative summary

print(cumulative_summary)
## # A tibble: 36 × 4
## # Groups:   Month [2]
##    Month  Plot Total_Mass Cumulative_Mass
##    <chr> <dbl>      <dbl>           <dbl>
##  1 July    901       19.6            19.6
##  2 July    902       15.8            15.8
##  3 July    903       28.6            28.6
##  4 July    904       17.9            17.9
##  5 July    905       17.4            17.4
##  6 July    906       26.0            26.0
##  7 July    907       19.0            19.0
##  8 July    908       17.6            17.6
##  9 July    909       24.4            24.4
## 10 July    910       13.7            13.7
## # ℹ 26 more rows
library(ggplot2)

ggplot(cumulative_summary, aes(x = Cumulative_Mass)) +
  geom_histogram(binwidth = 1, fill = "blue", color = "black", alpha = 0.7) +
  labs(title = "Histogram of Cumulative Maximum",
       x = "Mass in Grams",
       y = "Number of Plots") +
  theme_minimal()