[R] axis command and excel time format

Carmen Meier carmei3 at web.de
Wed Nov 8 17:27:11 CET 2006


Gabor Grothendieck schrieb:
> My understanding is that the main point of your post was how to get times
> on the X axis.   hopefully at this point its clear how to do that and 
> you can
> come up with some algorithm to put whatever points you want on.
That´s right thank you

>
> Here is a slight generalization although you will likely have to 
> generalize
> it further.  .....
this code works fine - just I was looking for
>
>> 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))  ....................


>> Gabor Grothendieck schrieb:
>> > 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
>> yes but ... ;-)
>> I started with an plain R gui
>>
>> library(zoo)
>> library(chron)
>> # input data
>> # z is from original example
>> mn <- times("23:00:00")
>> mx <- times("23:55:00")
>> n <- 12
>> z <-(1:50)
>> xt <- times(seq(mn, mx, length = n))
>> plot(z, xaxt = "n")
>> axis(1, xt, sub(":00$", "", xt))
>>
>>
>> The result is an X-axes with 23:00 at the left side nothing else at the
>> x-axis
>
> Not for me.  It gives ticks all along the x axis for me.  I have placed
> the entire self contained code above just to be sure.
This one (above) does not work

R.version.string
[1] "R version 2.4.0 (2006-10-03)"
 > packageDescription("chron")$Version
[1] "2.3-9"

Regards Carmen



More information about the R-help mailing list