[R] Plotting zoo objects with chron axis
Manta
mantino84 at libero.it
Fri Aug 9 12:08:09 CEST 2013
Dear all,
I have a problem which I'm not to fix. I have the following two series:
a=structure(c(33242.5196150509, 34905.8434338503, 38490.6957848689,
38747.0287172129, 38919.1028597142, 39026.3956586941, 38705.5344288997,
38545.6274379387, 38651.2079354205, 38748.2769580121), index =
structure(c(14029,
14032, 14033, 14034, 14035, 14036, 14039, 14040, 14041, 14042
), class = "Date"), class = "zoo")
b=structure(c(53337.7643740991, 52210.2079727035, 50235.4480363949,
50667.1147389469, 50796.5403152116, 51113.5420947436, 51003.3603311344,
50654.0539778796, 49927.5267060329, 49320.1813921822), index =
structure(c(14029,
14032, 14033, 14034, 14035, 14036, 14039, 14040, 14041, 14042
), class = "Date"), class = "zoo")
I want to plot them on the same chart, with the x-axis the Date, and the
y-axis the time in format %H:%M. At the moment, the y series is expressed in
seconds from midnight. I am confused with the as.POSIXct conversion.
> hours(min(rollrep))
[1] 9
> minutes(min(rollrep))
[1] 34
> seconds(min(rollrep))
[1] 27
however, by doing the following it seems the minimum time is 11:09, which is
not true.
as.POSIXct(round(min(rollrep)),origin=Sys.Date())
[1] "2013-08-09 11:09:14 CEST"
Do you have any advice? Is there a way to plot only the hours and minutes,
without having to go to the Sys.Date?
Thank you,
Marco
--
View this message in context: http://r.789695.n4.nabble.com/Plotting-zoo-objects-with-chron-axis-tp4673412.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list