[R] axis command and excel time format

Gabor Grothendieck
Wed, 08 Nov 2006 16:39:03 -0000

You indicated that one of the solutions did not work for you but
I am not clear which one you were referring to.  To avoid confusion
I have deleted all my and your comments except for the following
which works for me if I paste it into a fresh session using
   Edit | Paste commands only
menu in Windows XP:

> library(zoo)
> library(chron)

> tt <- c("23:05:02", "23:10:02",
"23:15:03", "23:20:03", "23:25:03",
+    "23:30:03", "23:35:03", "23:40:03",
"23:45:04", "23:50:04", "23:55:03",
+    "23:55:03")
> x <- c(0.575764, 0.738379, 0.567414, 0.663436, 0.599834, 0.679571,
+    0.88141, 0.868848, 0.969271, 0.878968, 0.990972, 0.990972)

> z <- zoo(x, times(tt))

> mn <- times("23:00:00")
> mx <- times("23:55:00")
> n <- 12

> xt <- times(seq(mn, mx, length = n))

> xt <- times(unique(sub("..$", "00", xt)))

> plot(z, xaxt = "n")
> axis(1, xt, sub(":00$", "", xt))

> R.version.string
[1] "R version 2.4.0 Patched (2006-10-24
r39722)"
> packageDescription("zoo")$Version
[1] "1.2-1"
> packageDescription("chron")$Version
[1] "2.3-9"