addStatsToSparseHandledData: Return the mean and limits for the sparse data frame,...

Description Usage Arguments Details Value Author(s)

View source: R/addStatsToSparseHandledData.R

Description

This function takes a data frame outputted from the mergeCalSparseFrames function and paritions the data frame by the rateParitionVec parameter. It then finds the mean and limits, and colors data points accordingly.

Usage

1
2
3
addStatsToSparseHandledData(sparseRateFrame, ratePartitionVec,
  ignorePeriods = 0, returnLimits = FALSE, limitFactor = 3,
  limitSide = "upper", altUL = 0.001, altLL = 0, keepPeriods)

Arguments

sparseRateFrame

a sparse data frame created using the mergeCalSparseFrames function

ratePartitionVec

a character string vector that specifies how to parition the categories in the data frame

ignorePeriods

a numeric, default of 0, that indicates how many periods from the current DateGroup to neglect in calculating the average and standard deviation

returnLimits

a logical with default FALSE that specifies whether or not the data frame returned should have limits

limitFactor

a numeric, default of 3, that specifies the number of standard deviations from the mean to set the limit

limitSide

a character string, default of upper, that indicates whether the limit should be +X from the mean (upper), -X from the mean (lower), or +/-X from the mean (two.sided)

altUL

a numeric, default of 0.001, that indicates a default limit if the altUL > limitFactor*sd(X)

altLL

a numeric, default of 0, that indicates a default limit if the altLL < limitFactor*sd(X)

keepPeriods

is an integer indicating the number of dategroup periods that will going into calculating the mean/standard deviation (i.e. 2 would mean 2 weeks if you have week dategroups)

dategroup

is a string indicating which dategroup the input sparseRateFrame has, i.e. "Week", "Month", "Quarter"

Details

This function takes in a sparseRateFrame that is made using the mergeCalSparseFrames function and return the mean for each unique combination of the entries in the ratePartitionVec. If the limit parameters are entered, the Rate variable is colored as 'pass' or 'review' based on limitFactor*sd(X) and that value is either added, subtracted, or added and subtracted to make a range about the mean where the data set falls in or out of teh limits. The altUL and altLL allow the user to specify an alternate limit that can be applied instead of the limitFactor.

Value

a data frame that contains the orginal columns in sparseRateFrame, as well as an average for each of the ratePartitionVec combinations. It may also have limits if limit parameters are specified.

Author(s)

Aimie Faucett


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