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

Description Usage Arguments Details Value Author(s)

View source: R/aggregateAndFillDateGroupGaps.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
aggregateAndFillDateGroupGaps(msCalFrame, yearSubGroup, gappedFrame, colsToAgg,
  startDate, functionCol, funToPerform, sparseHandling)

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'

gappedFrame

is a data.frame containing a Year and [yearSubGroup], as well as additional columns that are sparesely populated

colsToAgg

is a vector of character strings which specifies which variables should be used as arguments to aggregate the numerical column (functionCol)

startDate

is a character string, such as what is returned from the findStartDate function

functionCol

is acharacter string indicating which variable of the gappedFrame should be aggregated, the variable should contain numeric values

funToPerform

is a character string specifying the function to pass to aggregate (options = 'sum','mean', etc.)

sparseHandling

is a numeric parameter than indicates how to handle sparse entries (i.e. DateGroups without entries) with options NA, 0, or 1

Details

The function takes in msCalFrame, yearSubGroup, gappedFrame, colsToAgg, startDate, functionCol, funToPerform, and sparseHandling parameter and returns a data.frame that contains all DateGroups (per the msCalFrame), colsToAgg (e.g. 'Version', 'Key', 'RecordedValue'), functionCol (e.g. 'Record' with sparseHandling filled into sparse dates for each unique combo of colsToAgg).

Value

a data frame that contains a DateGroup, colsToAgg, and a total of the functionCol for each DateGroup with the sparseHandling value for DateGroups not originally in the gappedFrame

Author(s)

Aimie Faucett


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