R: Matching hours by dates -


i new in r , i've been stuck on matching hour date awhile now. have date frame has column date , column hour. looks following

date         hour    june1        0             june1        1    june1        2     june1        0         june1        1     june2        0         june2        1 

i want able match same hour date. hours numbered 0-23. example, want hour 1 in june 1 matched , hour 2 in june 1 matched (and on). it's simple solution, can't figure out ): appreciate help!

you can use ddply plyr package that:

install.packages("plyr") library(plyr) ddply(mydata,.(date,hour),transform,mean.value=mean(value) 

note: assuming want match find out mean/median/sum etc of column called value. also, date need formatted as.date() before using above function.


Comments

Popular posts from this blog

css - Which browser returns the correct result for getBoundingClientRect of an SVG element? -

gcc - Calling fftR4() in c from assembly -

Function that returns a formatted array in VBA -