I have a data.table with a row for each day over a 30 year period with a number of different variable columns. The reason for using data.table is that the .csv file I\'m usi
If you're not looking for complicated functions and just want the mean, then the following should suffice:
DT[, sum(Runoff) / length(unique(year(Date))), list(Key, month(Date))] # Key month V1 #1: A 1 4.366667 #2: B 1 3.266667