get_step_average: Compute average daily steps taken.

Description Usage Arguments Details Value Examples

View source: R/daily_behaviour.R

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

1
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.

Details

This function will throw an error unless the following variables are found in the raw_data argument:

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.

Other capl functions called by this function include: validate_steps() and get_pedometer_wear_time().

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.

Examples

1
2
3
4
5
capl_demo_data <- get_capl_demo_data(10)

get_step_average(capl_demo_data)$step_average

# [1] 18365 12655 15493 12966 11396 13954 18456 13589 17543 11276

capl documentation built on March 16, 2021, 9:06 a.m.