[R] Date format in plot
Erik Iverson
eiverson at NMDP.ORG
Tue Sep 1 21:13:11 CEST 2009
We will need a reproducible example! Please give us R commands that display the behavior you're observing:
For example,
I am having trouble understanding the as.Date function. When I input 39939, I would like to get "06.05.2009", but when I try it, I get
> as.Date(39939)
Error in as.Date.numeric(39939) : 'origin' must be supplied
I looked up what origin Excel uses for its' dates, and it seems like it might be January 1, 1900, so I tried
as.Date(39939, origin = "1900-01-01")
[1] "2009-05-08"
Then we will much better be able to help you, because we will be able to paste your commands into R and see the results and make changes.
But this still seems to be off by two days. So did you really mean "06.05", or "08.05"?
-----Original Message-----
From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On Behalf Of swertie
Sent: Tuesday, September 01, 2009 12:59 PM
To: r-help at r-project.org
Subject: [R] Date format in plot
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
More information about the R-help
mailing list