DATETIME MAX.TEMP MIN.TEMP NEW.PRCP NEW.SNOW
18791 1999/03/20 06:00 0.4 -2.0 0 0.0
18911 1999/03/20 18:00 11.7 -1.5 0 0.0
19031 1999/03/21 06:00 6.9 2.0 -1 0.1
19151 1999/03/21 18:00 12.3 2.4 -1 0.0
19271 1999/03/22 06:00 2.6 -1.1 1 0.0
19391 1999/03/22 18:00 5.4 -2.3 0 0.0
19511 1999/03/23 06:00 1.1 -3.9 1 0.1
19631 1999/03/23 18:00 7.1 -3.1 0 0.1
19751 1999/03/24 06:00 1.6 -2.6 0 0.1
19871 1999/03/24 18:00 7.5 -0.8 1 0.1
I would like to get the daily mean for columns: MAX.TEMP, MIN.TEMP Also I would like to get the daily sum for columns: NEW.PRCP, NEW.SNOW
I have been trying to use data.table similar to an earlier question here
I started with trying to mimic the comment provided and began trying to just get the mean for MAX.TEMP:
setDT(new_Tbl)[, .(DATETIME = DATETIME[1L], MAX.TEMP = mean(MAX.TEMP)),
by = .(indx = substr(DATETIME,12,13) == '06'))]
Which returns errors for unexpected ] and ) and could not find function"."
I am assuming there are shortcuts in the syntax that I do not follow. I appreciate the help and patience.