[R-SIG-Finance] Time series in half hourly intervals- how do i do it?/

Brian G. Peterson brian at braverock.com
Mon Sep 27 11:22:07 CEST 2010


On Mon, 27 Sep 2010 17:21:47 +1000, "Adrian Ladaniwskyj"
<Adrian.Ladaniwskyj at hydro.com.au> wrote:
> Hi all;
> 
> I'm working on a half hourly interval time series that looks like so:
> 
> 
> a)
> iteration         Datetime    VIC1    NSW1     SA1    QLD1
> 1         1 2011-01-01 00:30 5482.09 7670.81 2316.22 5465.13
> 2         1 2011-01-01 01:00 5178.33 7474.04 2130.30 5218.61
> 3         1 2011-01-01 01:30 4975.51 7163.73 2042.39 5058.19
> 4         1 2011-01-01 02:00 5295.36 6850.14 1940.19 4897.96
> 5         1 2011-01-01 02:30 5042.64 6587.94 1836.19 4749.05
> 6         1 2011-01-01 03:00 4799.89 6388.51 1786.32 4672.92
> 
> 
> Because of the vast volume of data, thousands of points, I would like
> parse the table into a timeseries object, while keeping the date/time
> information like in table a) so when plotted, it's instantly
> recognisable which timeperiod it refers to, instead of "observation
> 500:700" etc etc.  (i.e. I want the human readable time/date to be on
> the x axis)
> 
> Plotting extracts from b), below, just doesn't produce what I am looking
> for.
> 
> b)
> datetime    VIC1a    NSW1a     SA1a    QLD1a
> [1,]        1 5812.712 7251.341 2293.058 5410.479
> [2,]        2 5495.955 7078.464 2108.997 5166.424
> [3,]        3 5291.423 6833.390 2021.966 5007.608
> [4,]        4 5622.505 6544.065 1920.788 4848.980
> [5,]        5 5347.363 6301.389 1817.828 4701.560
> 
> From the help files, I can't figure out how to put half hourly data into
> a time series object properly- I'm hoping someone can help me out here.

'thousands of points' hardly qualifies as vast amounts of data.

use xts with a POSIXct index.  It will solve your problem.  There are
plenty of examples in the list archives and the documentation that should
show you how.

If you're still having issues, please provide a reproducible example, per
the posting guide.

Regards,

    - Brian

-- 
Brian G. Peterson
http://braverock.com/brian/
Ph: 773-459-4973
IM: bgpbraverock



More information about the R-SIG-Finance mailing list