xmR: Generate the XMR data for any time-series data.

Description Usage Arguments Examples

View source: R/xmR.R

Description

Will be used to calculate XMR data.

Usage

1
xmR(df, measure, interval, recalc, reuse, testing, longrun, shortrun)

Arguments

df

The dataframe containing the time-series data. Must be in tidy format. At least 1 variable for time and one variable for measure.

measure

The column containing the measure. Must be in numeric format.

interval

The interval you'd like to use to calculate the averages. Defaults to 5.

recalc

Logical: if you'd like it to recalculate bounds. Defaults to False

reuse

Logical: Should points be re-used in calculations? Defaults to False

longrun

Vector of 2 to determine rules for long run. First point is the 'n' of points used to recalculate with, and the second is to determine what qualifies as a long run. Default is c(5,8) which uses the first 5 points of a run of 8 to recalculate the bounds.

shortrun

Vector of 2 to determine rules for a short run. The first point is the minimium number of points within the set to qualify a shortrun, and the second is the length of a possible set. Default is c(3,4) which states that 3 of 4 points need to pass the test to be used in a calculation.

rules

Long Runs - Consecutive points above or below the central line and after the initializing point. If a long run is present, then use the first n points to recalculate the new bounds, after which these points are never to be used again.

Short Runs - Points that are closer to either bound than they are to the central line and after the initializng points. Newly calculated bounds begin at the first point in the short run, and extend to the end of the chart unless re-calculated after the end of the run.

Examples

1
2
3
4
5
6
dat.xmr <- xmR(dat, "Measure", 5)
dat.xmr <- dat %>% 
          group_by(., Program, Variable) %>% 
          do(xmR(., measure = "Retention Rate", 
          interval = 5, recalc = T))           
xmR_chart(., "Time", "Measure", "Facet")

Zanidean/sRa documentation built on May 7, 2019, 7:44 a.m.