Try this: > library(zoo) # as.yearqtr > > # test data > x <- c("sep2009", "oct2009") > > # convert to "yearqtr" class and from that to Date using frac = 1 > # where frac is between 0 and 1 inclusive indicating where > # in the month the output date should be set to > > as.Date(as.yearqtr(x, "%b%Y"), frac = 1) [1] "2009-09-30" "2009-12-31"
On Sun, Sep 13, 2009 at 2:18 PM, megh <megh700...@yahoo.com> wrote: > > Is there any R function to calculate automatically the last day of a > particular month? For example "sep2009" should be converted to last day of > September of 2009? > > Thanks > -- > View this message in context: > http://www.nabble.com/How-to-get-last-day-of-a-month--tp25425645p25425645.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > R-help@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. > ______________________________________________ R-help@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.