From: Gabor Grothendieck <ggrothendieck_at_gmail.com>

Date: Tue 20 Dec 2005 - 03:58:49 EST

R-help@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 Received on Tue Dec 20 04:04:44 2005

Date: Tue 20 Dec 2005 - 03:58:49 EST

The zoo package has a yearmon class with as methods which can be used:

library(zoo)

dd <- Sys.Date() # test data

as.Date(as.yearmon(dd), frac = 1)

as.yearmon converts the "Date" class date to a year and month of class "yearmon" dropping the day and representing it internally in a way consistent with "ts" class.

as.Date above then converts it back to "Date" class. Since yearmon dates have no day (they are just a year and a month) the frac argument is used to indicate what fraction of the month to use as the day of the month so frac = 0 (the default) would give the beginning of the month) and frac = 1 gives the end.

On 12/19/05, t c <quantpm@yahoo.com> wrote:

> I have a vector of dates.

*>
**> I wish to find the month end date for each.
**>
**> Any suggestions?
**>
**> e.g.
**>
**> For 12/15/05, I want 12/31/05,
**>
**> For 10/15/1995, I want 10/31/1995, etc
**>
**>
**> __________________________________________________
**>
**>
**>
**> [[alternative HTML version deleted]]
**>
**> ______________________________________________
**> R-help@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
**>
*

R-help@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 Received on Tue Dec 20 04:04:44 2005

*
This archive was generated by hypermail 2.1.8
: Fri 03 Mar 2006 - 03:41:40 EST
*