Skip to contents

This function calculates the average minutes of exercise per day across a week of accelerometer data. It takes seven parameters, each representing the minutes of exercise on a specific day (Day 1 to Day 7) of accelerometer measurement. The function computes the average of these values to obtain the average minutes of exercise per day.

Usage

find_week_accelerometer_average(
  AMMDMVA1,
  AMMDMVA2,
  AMMDMVA3,
  AMMDMVA4,
  AMMDMVA5,
  AMMDMVA6,
  AMMDMVA7
)

Arguments

AMMDMVA1

numeric A numeric representing minutes of exercise on Day 1 of accelerometer measurement.

AMMDMVA2

numeric A numeric representing minutes of exercise on Day 2 of accelerometer measurement.

AMMDMVA3

numeric A numeric representing minutes of exercise on Day 3 of accelerometer measurement.

AMMDMVA4

numeric A numeric representing minutes of exercise on Day 4 of accelerometer measurement.

AMMDMVA5

numeric A numeric representing minutes of exercise on Day 5 of accelerometer measurement.

AMMDMVA6

numeric A numeric representing minutes of exercise on Day 6 of accelerometer measurement.

AMMDMVA7

numeric A numeric representing minutes of exercise on Day 7 of accelerometer measurement.

Value

numeric The average minutes of exercise per day across a week of accelerometer use. If inputs are invalid or out of bounds, the function returns a tagged NA.

Details

This function processes physical activity data from accelerometer measurements to create a weekly activity summary.

     **Data Quality Requirements:**
     - Requires complete 7-day data (missing days result in tagged NA)
     - This conservative approach ensures reliable activity estimates
     - Zero values are preserved (represent valid no-activity days)

     **Missing Data Codes:**
     - For all input variables:
       - `9996`: Valid skip. Handled as `haven::tagged_na("a")`.
       - `9997-9999`: Don't know, refusal, or not stated. Handled as `haven::tagged_na("b")`.

See also

minperday_to_minperweek() for activity unit conversion, categorize_minperweek() for activity level classification

Examples

# Scalar usage: Single respondent
# Example: Calculate the average minutes of exercise per day for a week of accelerometer data.
find_week_accelerometer_average(30, 40, 25, 35, 20, 45, 50)
#> [1] 35
# Output: 35

# Example: Respondent has non-response values for all inputs.
result <- find_week_accelerometer_average(9998, 9998, 9998, 9998, 9998, 9998, 9998)
result # Shows: NA
#> [1] NA
haven::is_tagged_na(result, "b") # Shows: TRUE (confirms it's tagged NA(b))
#> [1] TRUE
format(result, tag = TRUE) # Shows: "NA(b)" (displays the tag)
#> [1] "NA"

# Multiple respondents
find_week_accelerometer_average(
  c(30, 20), c(40, 30), c(25, 35), c(35, 45),
  c(20, 25), c(45, 55), c(50, 60)
)
#> [1] 35.00000 38.57143
# Returns: c(35, 39.28571)