get_mean_sd_hour: get subject average of time variables

View source: R/RA2.R

get_mean_sd_hourR Documentation

get subject average of time variables

Description

A function for calcualting the average timing of variables (in this case the M10 and L5). Find the average timing mu that min( sum ( min( (tind_i - mu)^2, (1440 + mu - tind_i )^2 )))

Usage

get_mean_sd_hour(tind, unit2minute = 60, out = c("mean", "sd"))

Arguments

tind

numeric A vector of times which we want to get an average/sd for. The first two columns have to be ID and Day.

unit2minute

numeric The ratio of the unit of time and minute. For example, the input unit is hour, the unit2minute = 60.

out

character Specify get the mean or sd of the time variables. Default=c("mean","sd") when both mean and sd are calculated.

Value

mean and sd of the input timing

Examples

x=c(1,1,1,23,23,23) 
get_mean_sd_hour(tind=x,  unit2minute=60) 
x=12+c(1,1,1,23,23,23) 
get_mean_sd_hour(tind=x,  unit2minute=60)   
x=c(1:100/5, 20+4:50/200) 
get_mean_sd_hour(tind=x,  unit2minute=60)


mMARCH.AC documentation built on June 8, 2025, 1:24 p.m.