Reputation: 891
I create the following time series
t = seq(as.POSIXct('2014-12-05 10:01:00'), length.out = 4, by = 'mins')
x = c(1,3,4,2)
y = as.ts(x,t)
When I try to view (in a plot) my time series, the time tags are not the values I entered in t.
plot(y)
time(y)
[1] 1 2 3 4
How can I fix it?
Upvotes: 1
Views: 183
Reputation: 3888
I would use the xts
package, ie. create the Time-Series as an xts
object instead and then leverage on plot.xts
:
library(xts)
y.xts <- xts(x, t)
plot(y.xts)
Upvotes: 1