Read R News 4/1 help desk article about dates.
Also see ?as.yearmon in the zoo package.
> library(zoo)
> dd <- Sys.Date() + seq(1, 1000, 100)
> dd
[1] "2007-03-09" "2007-06-17" "2007-09-25"
"2008-01-03" "2008-04-12"
[6] "2008-07-21" "2008-10-29" "2009-02-06"
"2009-05-17" "2009-08-25"> ym <- as.yearmon(dd)
> ym
[1] "Mar 2007" "Jun 2007" "Sep 2007" "Jan
2008" "Apr 2008" "Jul 2008"
[7] "Oct 2008" "Feb 2009" "May 2009" "Aug
2009"> dd2 <- as.Date(ym)
> dd2
[1] "2007-03-01" "2007-06-01" "2007-09-01"
"2008-01-01" "2008-04-01"
[6] "2008-07-01" "2008-10-01" "2009-02-01"
"2009-05-01" "2009-08-01"> plot(dd2, 1:10)
On 3/8/07, Steven F White <Steven_F_White at raytheon.com>
wrote:> Greets Folks,
>
> I've been wrestling with how to better control plotting of time data
and
> just can't seem to see the right path. My dataset has thousands of
points
> distributes across a number of years. I would like to plot the responses
> according to increasing time with nice boundaries - perhaps integer months
> - along the abscissa. However, the earliest time occurs mid-month and I
> cannot figure out how to properly truncate the minimum date in the dataset
> to an integer month for use in the xlim= and at= statements to set the
> plotting range on month boundaries.
>
> Thanks in advance for your help or advice.
>
> Best Regards,
> Steve
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at stat.math.ethz.ch 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.
>