I am new to R and have been trying to create a ts object for the stock market hourly data on which I can apply time series analysis.
an example of my data looks like below (I'll take hourly volume data for a stock in this case):
Date Volume
1 2018-03-01 10:30:00 143432
2 2018-03-01 11:30:00 93522
3 2018-03-01 12:30:00 152178
4 2018-03-01 13:30:00 117424
5 2018-03-01 14:30:00 268167
6 2018-03-01 15:30:00 245504
7 2018-03-01 15:59:00 288977
8 2018-03-02 10:30:00 230484
9 2018-03-02 11:30:00 265244
10 2018-03-02 12:30:00 183313
11 2018-03-02 13:30:00 130850
12 2018-03-02 14:30:00 139846
13 2018-03-02 15:30:00 257797
14 2018-03-02 15:59:00 261628
15 2018-03-05 10:30:00 140620
16 2018-03-05 11:30:00 171228
17 2018-03-05 12:30:00 118685
18 2018-03-05 13:30:00 107209
19 2018-03-05 14:30:00 116918
20 2018-03-05 15:30:00 225035
above data was created using:
temp <- read.csv("somefile.csv")
what I wanted to create was a ts object that captures the right frequency of the data so I could plot them correctly and analyse them using time series analysis. For example I can decompose the trend, seasonality from the ts object.
I've done some googling and stackoverflowing, I couldn't see any post mentioning same thing. I have tried using method in this post, but to no avail. I can't create a seq
that's cutomised to 7 hours a day.
what is a correct way to do this in r?