I am trying to plot a time series graph based on the data that looks like the following. The data contains values recorded for every 30 minutes for an entire day. For example the data logged for about 3 hours from a data frame looks like this:
The column names are time values shown in half-hours
00:00, 00:30, 01:00, 01:30, 02:00, 02:30, 03:00, 03:30, 04:00, 04:30, 05:00
And their respective data values are something like this
0.2, 0.4, 0.3, 0.6, 0.7, 0.6, 0.8, 0.10, 0.2, 0.5, 0.7
The data frame has many rows of data values for the given respective time columns. I need to plot a time series graph based on these values at the given time. I am able to plot the time series but have problems depicting the x-axis (time value)
Imagine a
is a vector taken from a row of the data frame, then:
a<-c(0.2, 0.4, 0.3, 0.6, 0.7, 0.6, 0.8, 0.10, 0.2, 0.5, 0.7)
a.ts <- ts(a, start=0, frequency=24)
plot(a.ts)
I am getting the time series graph as below, but I will need to have the respective hour values (i.e, 00:00, 00:30, and so on..) in the x-axis instead of start = 0 and so on.
I've read from the documentation that the ts()
only allows to specify year and month start values. Now I will need an hour start value (00:00) in my graph that goes on till 05:00.