match.week.to.month: Find the month containing a week

Description Usage Arguments Value Author(s) See Also Examples

Description

Returns the index of a month, in a sequence of months, that contains a given week.

Usage

1
   MatchWeekToMonth(week.ending, origin.month)

Arguments

week.ending

A vector of class Date. Each entry contains the date of the last day in a week.

origin.month

A Date, giving any day in the month to use as the origin of the sequence (month 1).

Value

The index of the month matching the month containing the first day in week.ending. The origin is month 1. It is the caller's responsibility to ensure that these indices correspond to legal values in a particular vector of months.

Author(s)

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

See Also

bsts.mixed.

Examples

1
2
3
4
5
6
  origin.month <- as.Date("2011-09-01")
  week.ending <- as.Date(c("2011-10-01",   ## 1
                           "2011-10-08",   ## 2
                           "2011-12-03",   ## 3
                           "2011-12-31"))  ## 4
  MatchWeekToMonth(week.ending, origin.month) == 1:4

michelletran/bsts documentation built on March 29, 2020, 12:58 a.m.