last.day.in.month {bsts}R Documentation

Find the last day in a month

Description

Finds the last day in the month containing a specefied date.

Usage

   LastDayInMonth(dates)

Arguments

dates

A vector of class Date.

Value

A vector of class Date where each entry is the last day in the month containing the corresponding entry in dates.

Author(s)

Steven L. Scott steve.the.bayesian@gmail.com

Examples

 inputs <- as.Date(c("2007-01-01",
                     "2007-01-31",
                     "2008-02-01",
                     "2008-02-29",
                     "2008-03-14",
                     "2008-12-01",
                     "2008-12-31"))
 expected.outputs <- as.Date(c("2007-01-31",
                              "2007-01-31",
                              "2008-02-29",
                              "2008-02-29",
                              "2008-03-31",
                              "2008-12-31",
                              "2008-12-31"))
 LastDayInMonth(inputs) == expected.outputs

[Package bsts version 0.9.10 Index]