findStartDate: Find the start date in the format of a character DateGroup...

Description Usage Arguments Details Value Author(s)

View source: R/findStartDate.R

Description

The function sequences DateGroups from last date to today, incrementing by -1, and keeps the number of DateGroup units as specified by the user.

Usage

1
2
findStartDate(msCalFrame, yearSubGroup, timeUnitsToKeep, rollPeriods = 0,
  keepPeriods)

Arguments

msCalFrame

is a data frame (non-sparse) of all dates and DateGroups, an output of createCalendarLikeMicrosoft function

yearSubGroup

is a sub-group of a year, i.e. 'Week', 'Month', or 'Quarter'

timeUnitsToKeep

is a numeric value indicating how many of DateGroup entries to keep (incremented by 1 backwards from today's DateGroup)

rollPeriods

is a numeric value indicating how many additional periods should be included in case the user wants to find a rolling sum, the default is 0.

keepPeriods

is a numeric value indicating how many periods to keep such that the limit at calculation is the same as what it would have been when the period was current.

Details

This function takes in msCalFrame, yearSubGroup, timeUnitsToKeep, and rollPeriods. The unique msCalFrame DateGroups are found and then sequenced in descending order. The number of entries kept is specified by timeUnitsToKeep + rollPeriods. The function returns the startDate (character string) as determined by the timeUnitsToKeep + rollPeriods prior to the most current DateGroup.

Value

a character string DateGroup at timeUnitsToKeep + rollPeriods prior (e.g. 2016-01 if today's DateGroup is 2016-10 and timeUnitsToKeep = 9 and rollPeriods = 0)

Author(s)

Aimie Faucett


BioAimie/dateManip documentation built on May 5, 2019, 3:46 p.m.