[R] Ragged time series data

stephen sefick ssefick at gmail.com
Sat Oct 4 02:40:27 CEST 2008


If you want quick and reliable help it is always best to provide a
reproducible example.  I learned this after much reminding.  The
rational is if you do the work to frame the problem then answers can
be provided swiftly and correctly with the least amount of headache on
both sides of the email.  To take a guess at what you would like look
at the zoo package and the apply functions that are provided with this
package they should do what you want, and if you provide a
reproducible example then I can try and figure it out.  Also, there is
a good possibility that this may have been answered aready type in R
nabble in google-  you can search the mailing list in this way.
good luck

On Fri, Oct 3, 2008 at 7:39 PM, Joe Kaser <jmkaser at gmail.com> wrote:
> 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 at 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.
>



-- 
Stephen Sefick
Research Scientist
Southeastern Natural Sciences Academy

Let's not spend our time and resources thinking about things that are
so little or so large that all they really do for us is puff us up and
make us feel like gods.  We are mammals, and have not exhausted the
annoying little problems of being mammals.

								-K. Mullis



More information about the R-help mailing list