RAR_Local | R Documentation |
Calculates mean, standard deviation, and relative activity within user-specified time-bin widths (e.g. 4 hour time bins) across days. If user-specified, time will be adjusted for average rise-time.
RAR_Local(df, act_column, time_column, hour_bin, log_transform = c(TRUE,
FALSE), wake_hr = NULL, id_column = NULL)
df |
dataframe containing actigraphy data and time. |
act_column |
name of the column within df that contains the activity count data. |
time_column |
name of the column that contains date and time of observation. Time must be a POSIX object. |
hour_bin |
user-specified numeric of hour length of bin (e.g. 4). |
log_transform |
specifies if log transformation of activity data should be performed. |
wake_hr |
average rise (i.e. wake) time for participant in hours. Must be numeric for single participant. For multiple participants, wake_hr must be merged in to activity dataset (df), wake_hr in this case represents the column name. |
id_column |
name of column containing id if multiple subjects exist in dataframe. |
Jessica Graves
data(age_wise)
d <- age_wise[age_wise$id==1,]
rar_ex <- RAR(d, act, date_time)
# wake-hour adjusted, log scale
local <- RAR_Local(d, act, date_time, 4, TRUE, rar_ex$parameters$tLeft)
local$localized # mean, sd, and relative activity estiamtes across days within bins
# Multiple subjects
d4 <- age_wise[age_wise$id %in% c(1:4), ]
rar_ex4 <- RAR(d4, act, date_time, id_column=id)
d4.2 <- merge(d4, rar_ex4$parameters, by="id")
local4 <- RAR_Local(d4.2, act, date_time, 4, wake_hr=tLeft, id_column=id) # wake-hour adjusted
local4$localized
local4.clock <- RAR_Local(d4.2, act, date_time, 4, id_column=id) # clock time, log scale
local4.clock$localized
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.