[R] hour in x-axis

threshold r.kozarski at gmail.com
Tue Nov 29 19:07:52 CET 2011


Dear R useres, got the following problem. Given the AggData (listed below)
I need to plot AggData[,2] vs time (AggData[,1]) for chosen 'rows'. Ive done
already:

plot(AggData[rows,2], xaxt='n')
axis(1,at=seq(1,length(rows),1),sub("","", AggData[rows,1]))

which works, but I need to list only chosen data points, say full hours or
every 60th point, something like:

axis(1,at=seq(1,seq(1,length(rows),60)),sub("", "",
AggData[day.rows[seq(1,length(rows),60)],2]))

but does not work. Could be nice if time on the x-axis is in H:m format (no
seconds).

In the original data time bout is 1 minute, e.g. 17:19:35, 17:20:35,
17:21:35 . Taken every 100th for brevity yields

> (AggData[seq(1,length(rows),100),c(2,7)])

      time                 value
1    17:19:35    80.68327
101  18:59:35    80.97230
201  20:39:35    78.30810
301  22:19:35    80.41558
401  23:59:35    77.01051
501  01:39:35    77.19687
601  03:19:35    78.20762
701  04:59:35    77.13315
801  06:39:35    76.29110
901  08:19:35    75.32090
1001 09:59:35    85.32890
1101 11:39:35    79.86978
1201 13:19:35    83.32418
1301 14:59:35    78.26018
1401 16:39:35    79.06434


Thanks in advance.
Best, robert




--
View this message in context: http://r.789695.n4.nabble.com/hour-in-x-axis-tp4120142p4120142.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list