GetDiary_subj {ActiSleep} | R Documentation |
Obtain table of in-bed and out-bed times from sleep diary data
GetDiary_subj(datain, subj_idx, idx_bed, idx_wake, tz = "GMT")
datain |
input dataset, must be a data frame |
subj_idx |
index indicating subject |
idx_bed |
array specifying indices for in-bed time data |
idx_wake |
array specifying indices for out-bed time data |
tz |
timezone, default is GMT |
dataframe with in-bed and out-bed times
data("SleepDiary1Week")
SleepDiary1Week <-
ChangeTimeVar(SleepDiary1Week, c(5:18), format = "%m/%d/%Y %H:%M")
colIdx_diary_bed <- c(1:7) * 2 - 2 + 5
colIdx_diary_wake <- c(1:7) * 2 - 1 + 5
GetDiary_subj(
SleepDiary1Week,
1,
colIdx_diary_bed,
colIdx_diary_wake,
tz = "GMT")