get_step_average: Compute average daily steps taken.
Description
This function computes the daily arithmetic mean of a week of steps taken as measured by a pedometer (step_average). This variable is used to compute
the step score (step_score).
Usage
get_step_average(raw_data = NULL)
Arguments
raw_data
A data frame that includes seven days of pedometer steps and their corresponding on and off times. See Details for how these variables
must be named.
Value
Returns a data frame with nine columns: steps1 (validated), steps2 (validated), steps3 (validated), steps4 (validated), steps5 (validated), steps6 (validated), steps7 (validated), valid_days and step_average. The steps are validated with the validate_steps() function.
Details
This function will throw an error unless the following variables are found in the raw_data argument:
steps1
steps2
steps3
steps4
steps5
steps6
steps7
time_on1
time_on2
time_on3
time_on4
time_on5
time_on6
time_on7
time_off1
time_off2
time_off3
time_off4
time_off5
time_off6
time_off7
There must be at least three valid days for an arithmetic mean to be computed. If only three valid days, one of the step values from a valid
day will be randomly sampled and used for the fourth valid day before computing the mean.