Determine event windows for activities
windows.Rd
Determine sleep, nap, work, and monitor wear windows recorded by the Actiwatch or by the subject in their diary.
Usage
windows_sleep(sleep)
windows_nap(sleep, interval = "first")
windows_work(sleep)
windows_monitor(sleep)
Arguments
- sleep
A
data.sleep
object produced byread_sleep()
.- interval
For
windows_nap()
, a character taking a value of"first"
or"second"
to denote if first or second napping windows. Default is"first"
.
Value
A list
containing two numeric vectors named start
and end
that
are formatted as date-time (POSIXct
) based on UTC time-zone.
Details
These functions require that a data.sleep
object is used as this
type of object contains the specific variable names to determine the daily
windows of sleep, naps, work, and monitor wear.
The sleep and nap windows may be soley on times recorded by the Actiwatch,
which tracks information based on activity, light, and event markers.
Variables that end with input
will denote how the sleep and nap windows
should be recorded. Below is a list of the input values and their relation
to how the times are to be record.
1
denotes event marker time2
denotes white light time3
denotes diary record time4
denotes activity time
Each of the windows are initialing created with diary dates recorded by the subject. The dates and times are altered based on time of day in relation to the initial date. As an example, suppose subject 0001-AB records information in their diary on 01-01-2023, including their sleep onset and wake times. With the Pregnancy 24/7 study, the start of each day begins with sleep onset. So, the sleep onset and wake times initially start with the same date and need to be altered so a wake time of 6:00 AM is actually recorded to occur on 01-02-2023 and not 01-01-2023. Or, if the sleep onset time was at 12:00 AM, the date is recorded as 01-02-2023.
windows_work()
and windows_monitor()
are soley based on times recorded
by the subject in their log.
The window creation functions also may require user input if their is a missing date or time. It will prompt you with a question whether to proceed with processing the windows given a certain day has missing data. If it is known had of time that certain days will have invalid data the missing data may not be problem, as the invalid data will be excluded later.
The interval
parameter for windows_nap
allows for recording two naps a
day during the wear period. It is assumed the second napping intervals have
variable names that end in _b#
, where #
denotes the wear day.
Examples
if (FALSE) { # \dontrun{
wind_sleep <- windows_sleep(sleep = sleep)
sleep_start <- wind_sleep$start
sleep_end <- wind_sleep$end
} # }
if (FALSE) { # \dontrun{
wind_nap <- windows_nap(sleep = sleep)
nap_start <- wind_nap$start
nap_end <- wind_nap$end
} # }
if (FALSE) { # \dontrun{
wind_work <- windows_work(sleep = sleep)
work_start <- wind_work$start
work_end <- wind_work$end
} # }
if (FALSE) { # \dontrun{
wind_monitor <- windows_monitor(sleep = sleep)
monitor_off <- wind_monitor$start
monitor_on <- wind_monitor$end
} # }