[R] axis command and excel time format

Gabor Grothendieck ggrothendieck at gmail.com
Wed Nov 8 14:45:50 CET 2006


Is the problem how to produce an axis with a given minimum tick,
maximum tick and given number of ticks?  In that case try this
(if not explain further):

# input data
# z is from original example
mn <- times("23:00:00")
mx <- times("23:55:00")
n <- 12

xt <- times(seq(mn, mx, length = n))
plot(z, xaxt = "n")
axis(1, xt, sub(":00$", "", xt))

If this is not what you want please explain further.

On 11/8/06, Carmen Meier <carmei3 at web.de> wrote:
> Thank you for your reply Gabor,
> sure, the manually written axis works fine in any configuration.
> but I would prefer an "automatic" input.
> That means that I would like to use the datafield[1] for the minimum
> time and the datafield[max] (means the last one) for the maximum time.
> divided into x steps.The datafiled size could reach more than 7000 sec.
>
> With regards Carmen
>
> Gabor Grothendieck schrieb:
> > Try this:
> >
> > plot(z, xaxt = "n")
> > xt <- paste("23", seq(5, 50, 5), sep = ":")
> > axis(1, times(paste(xt, 0, sep = ":")), xt)
> >
> >>
> >> I have some problems to get the times-scale to the x-axis the times are
> >> coming from an excel sheet f. e
> >> [1] "0:01:00" "0:02:00" "0:03:00" "0:04:00" "0:05:00" "0:06:00"
> >> "0:07:00"
> >>  [8] "0:08:00" "0:09:00" "0:10:00" "0:11:00" "0:12:00" "0:13:00"
> >> "0:14:00"
> >> [15] "0:15:00" "0:16:00" "0:17:00" "0:18:00" "0:19:00" "0:20:00"
> >> "0:21:00"
> >> [22] "0:22:00" "0:23:00" "0:24:00" "0:25:00" "0:26:00" "0:27:00"
> >> "0:28:00"
> >> [29] "0:29:00" "0:30:00" "0:31:00" "0:32:00" "0:33:00" "0:34:00"
> >> "0:35:00"
> >> [36] "0:36:00" "0:37:00" "0:38:00" "0:39:00" "0:40:00" "0:41:00"
> >> "0:42:00"
> >> [43] "0:43:00" "0:44:00" "0:45:00" "0:46:00" "0:47:00" "0:48:00"
> >> "0:49:00"
> >> [50] "0:50:00"
> >>
>
>



More information about the R-help mailing list