I'm relatively new to R but I am very familiar with Excel and T-SQL.
I have a simple dataset that has a date with time and a numeric value associated it. What I'd like to do is summarize the numeric values by-hour of the day. I've found a couple resources for working with time-types in R but I was hoping to find a solution similar to is offered excel (where I can call a function and pass-in my date/time data and have it return the hour of the day).
Any suggestions would be appreciated - thanks!
breakdown:
Convert column of
DateTime
(character) into formatted time then usehour()
fromlubridate
to pull out just that hour value and put it into new column namedhour_of_day
.The
group_by(hour_of_day)
sets the groups upon whichmean(Value)
is computed in the via thesummarise(...)
call.this gives the result: