[R] Dates plotting backwards

Duncan Murdoch murdoch at stats.uwo.ca
Wed Nov 11 00:16:23 CET 2009


Sam Albers wrote:
> Hello,
>
> I am having a little trouble formatting my dates correctly. When I plot
> something using the following commands, R plots the most recent date on the
> left of the figure and then earlier date on the right of the figure. Given
> that English is read from left to right I would like to have the dates on my
> figure arranged in the same way.  I am sure that this is something fairly
> simple but I was wondering if someone could help me out. Here is a minimal
> example that should reproduce my problem. I've also included so data
> thinking that perhaps my data format was the problem.
>
> Thanks in advance!
>
> Sam
>
> Date=as.Date(test$Date, format= "%d/%m/%Y")
> plot(test$D.2D50.SA ~ test$Date)
>   

You calculated Date, then plotted test$Date.  Was that your intention?

Duncan Murdoch
> "Date","D.2D50.SA"
> 28/08/2009,60.67
> 28/08/2009,66.4
> 28/08/2009,50.19
> 28/08/2009,38.19
> 28/08/2009,50.19
> 12/09/2009,62.2
> 12/09/2009,93.77
> 12/09/2009,49.89
> 12/09/2009,106.34
> 12/09/2009,42.22
> 22/09/2009,24.15
> 22/09/2009,105.17
> 22/09/2009,15.04
> 22/09/2009,23.54
> 22/09/2009,19.6
> 05/10/2009,74.41
> 05/10/2009,34.78
> 05/10/2009,28.74
> 05/10/2009,41.29
> 05/10/2009,42.68
> 12/10/2009,46.26
> 12/10/2009,13.31
> 12/10/2009,29.95
> 12/10/2009,34.28
> 12/10/2009,74.51
> 19/10/2009,33.67
> 19/10/2009,69.86
> 19/10/2009,61.3
> 19/10/2009,21.38
> 19/10/2009,80.37
> 26/10/2009,20.69
> 26/10/2009,63.37
> 26/10/2009,70.91
> 26/10/2009,22.7
> 26/10/2009,23.89
>
>




More information about the R-help mailing list