0

I have a data frame that I have constructed in R. What I am trying to do is add the values for Column Total, removing the duplicated rows, retaining each column. So for the LGA = albury, offence type = assault, month = Jan and year = 1995, the total = 7 + 29 + 12 (48).

Dataframe

  • It would be easier to help if you create a small reproducible example along with expected output. Read about [how to give a reproducible example](http://stackoverflow.com/questions/5963269). Images are not the right way to share data/code. – Ronak Shah Jun 02 '21 at 03:14

1 Answers1

1

Using base R you could do:

aggregate(Total~., df, sum)
Onyambu
  • 67,392
  • 3
  • 24
  • 53
  • Thanks! After performing this, how would I next remove the month column, and then sum the amounts based on the year? – Luke Hansen Jun 02 '21 at 04:17