[R] Month end calculations

Jim Porzak jporzak at gmail.com
Thu Aug 30 05:44:20 CEST 2007


Hi Shubha,


By using the tautology that the end of a month is immediately followed
by the first of a month, the following returns a TRUE when the date is
the last day of a month

IsMonthEnd <- format(MyDates + 1, "%d") == "01"

where MyDates is a vector, or column in a data frame, typed as Date
(eg with as.Date)

-- 
HTH,
Jim Porzak
Responsys, Inc.
San Francisco, CA
http://www.linkedin.com/in/jimporzak

On 8/29/07, Shubha Vishwanath Karanth <shubhak at ambaresearch.com> wrote:
> Hi R users,
>
>
>
> Is there a function in R, which does some calculation only for the month
> end in a daily data?... In other words, is there a command in R,
> equivalent to "last." function in SAS?
>
>
>
> BR, Shubha
>
>
>         [[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.
>



More information about the R-help mailing list