Hi,
Does anyone know do a summary by group? I have the below dataframe and it comes with totals already.
I want to create a new column, using mutate, that will sum those trees together. Like this image below.
I tried ungroup() and doing another mutate but it doesn't seem to work. I've found a work around by creating a new summary by Counties only and doing a simple join but it has to be easier.
Trees = data.frame(
stringsAsFactors = FALSE,
Trees_COUNTY = c("Thunder Bay","Thunder Bay",
"Thunder Bay","Frontenac","Frontenac","Frontenac",
"Durham","Durham","Durham"),
Stores = c("A", "B", "C", "A", "B", "C", "A", "B", "C"),
Trees = c(761L, 1581L, 17201L, 351L, 421L, 15771L, 1891L, 291L, 14211L)
)
```r