[R] Date format in plot

David Winsemius dwinsemius at comcast.net
Tue Sep 1 21:15:17 CEST 2009


On Sep 1, 2009, at 1:58 PM, swertie wrote:

>
> Hello, I plot the abundance of a species in relation to the date. To  
> have the
> date as a continous variable I put it in the format "standard" in  
> excel
> (f.ex. 39939 means 06.05.2009). R uses 39939 on the x axis, but I  
> would like
> to have "06.05". I tried to use as.Date as suggested in some  
> discussion but
> I don't manage to use it, the returned date is not correct. Do you  
> have any
> clue? thank you

You may need to do some jiggling around because R doesn't agree with  
that number of days since the beginning of the last century:

 > as.Date(39939, origin="1900-01-01")
[1] "2009-05-08"

Then you need to look at docs re: the formating of date objects. Some  
code might move this process along.

-- 

David Winsemius, MD
Heritage Laboratories
West Hartford, CT




More information about the R-help mailing list