parse_sleepwake_sequence: Parse Sleep Wake Binary/Integer Sequence

View source: R/data_singlevectorformat.R

parse_sleepwake_sequenceR Documentation

Parse Sleep Wake Binary/Integer Sequence

Description

It is common to have sleep wake history information in the form of a binary sequence. This is the format used by SAFTE-FAST and other proprietary software. Further, this format is often easily exported by actigraphy measurement software.

Usage

parse_sleepwake_sequence(seq, epoch, series.start)

Arguments

seq

A sequence of 0 (sleep) and 1 (wake) integers indicating sleep/wake status at that moment.

epoch

Integer expressing length of each observations in the series (minutes).

series.start

A POSIXct object indicating the start datetime of the simulation (i.e., pre-first sleep waking duration)

Value

FIPS_df formatted dataframe

Examples

 
start_date = as.POSIXct("2018-05-01 10:00:00")
bitvector_sequence = rep(rep(c(1,0), 6), sample(20:40, 12))
FIPSdf_from_bitvec = parse_sleepwake_sequence(
 seq = bitvector_sequence,
 series.start = start_date,
 epoch = 15)


humanfactors/FIPS documentation built on Aug. 24, 2023, 6:33 p.m.