Hi and thanks in advance,

I am fairly new with R so I hope this problem isn't too amateur.

I have a vector of count data which correspond to vectors of date (%m/%d/%Y)
and time of day (%H:%M:%S).
I am trying to compute various statistics (e.g. daily max) by lumping the
data together by day.   I have been able to utilize tapply() and group the
counts together, but with the method I use I end up losing the corresponding
time of day information.

This is what I have done so far

data=*vector of integers
*hours= *"character" vector of times %H:%M:S% *
days= *"character" vector of dates %m/%d/%Y
*
hr.days=paste(days,hours)
hr.dayslt=as.POSIXlt(strptime(hr.days, format="%m/%d/%Y %H:%M:%S"))

tapply(data,hr.dayslt$yday,max)

This works to give me the counts I want corresponding to a Julain day, but
it does not tell me which hour corresponds to each daily maximum.  Is
tapply() the wrong route?

Joe
*


*

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to