[R] Date format in plot

jim holtman jholtman at gmail.com
Wed Sep 2 15:25:45 CEST 2009


A reproducible example would help.  What is "Phenology_VE$Date"?  This works

> as.Date("2009-09-01", "%Y-%m-%d")
[1] "2009-09-01"

Is this the date you wanted:

> as.Date(39936, origin='1900-2-1')
[1] "2009-06-05"



On Wed, Sep 2, 2009 at 2:09 AM, swertie<v_coudrain at voila.fr> wrote:
>
> As suggested in the article R News 4/1, I used
> as.Date(as.character(Phenology_VE$Date), "%Y-%m-%d"), however this function
> returns me only "NA" values
>
> as.Date(as.character(Phenology_VE$Date), "%Y-%m-%d")
>  [1] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
> NA
> [26] NA NA NA NA NA NA NA NA NA NA
>
>
> The date corresponding to 39939 is really 06.05.2009, so it doesn't match R
> format.
>
> I tried to use
>
> names(Date)<-c("06.05","07.05","11.05","19.05","20.05","22.05","23.05","24.05","28.05","29.05","31.05","03.06","04.06","09.06","10.06","12.06","14.06","17.06","24.06","29.06","30.06","01.07","26.07","27.07","29.07","04.08","05.08","12.08","13.08","14.08","17.08","18.08","19.08","27.08","28.08")
>
> plot(Date, Phenology_VE[,3], ylim=range(0, 16),
> main=names(Phenology_VE[3]),xaxt="n", yaxt="n")
> axis(1, labels=names(Date), at=Date)
>
> It works more or less, but I don't get regular intervals, but a thick for
> each date. Do you have any idea how I could represent only some dates?
> Thank you
>
>
>
> --
> View this message in context: http://www.nabble.com/Date-format-in-plot-tp25244066p25252150.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem that you are trying to solve?




More information about the R-help mailing list