get_pedometer_wear_time: Compute pedometer wear time in decimal hours for a given day.

View source: R/daily_behaviour.R

get_pedometer_wear_timeR Documentation

Compute pedometer wear time in decimal hours for a given day.

Description

This function computes pedometer wear time in decimal hours for a given day (e.g., wear_time1). This variable is used to compute the step_average variable and the step score (step_score).

Usage

get_pedometer_wear_time(time_on = NA, time_off = NA, non_wear_time = NA)

Arguments

time_on

A character vector representing the time (in 12- or 24-hour clock format) when the pedometer was first worn on a given day.

time_off

A character vector representing the time (in 12- or 24-hour clock format) when the pedometer was removed at the end of a given day.

non_wear_time

A numeric vector representing the total time (in minutes) the pedometer was not worn during waking hours on a given day.

Details

Other capl functions called by this function include: get_24_hour_clock() and validate_number().

Value

Returns a numeric vector with values >= 0 (if valid) or NA (if not valid).

Examples

get_pedometer_wear_time(
  time_on = c("6:23", "5:50 am", NA),
  time_off = c("21:37", "9:17pm", ""),
  c(60, 90, 0)
)

# [1] 14.23 13.95    NA


capl documentation built on April 8, 2022, 9:06 a.m.