mark_period: ABPM Periods

Description Usage Arguments Details Value Examples

View source: R/abpm_mark_phase.R

Description

During ABPM (ambulatory blood pressure monitoring), a person wears an ABPM device for a number of hours - usually 24. In most cases, this duration includes two periods where the person is awake and one period where they are asleep. For example, I woke up on Monday at 7am, began wearing my ABPM device on Monday at 9am, went to bed on Monday at 11pm, woke up on Tuesday at 7am, and took off my ABPM device on Tuesday at 9am. My first awake period is from 9am to 11pm on Monday. My second awake period is from 7am to 9am on Tuesday. My only asleep period is from 11pm Monday to 7am Tuesday.

Usage

1
mark_period(x, period_value, impute_from = c("left", "right"))

Arguments

x

(character) status values, e.g. c('Awake', 'Asleep', 'Awake')

period_value

(character) what status values should constitute a period? Status values not included in period_value will be ignored.

impute_from

(character) if 'left', then missing values in x will be filled in using the nearest value to the left (i.e., earlier). If 'right', then missing values are filled in using the nearest value on the right (i.e., later). Missing values on the boundaries are always filled in using the right if the first value is missing and the left if the last value is missing.

Details

In practice, it is helpful to label these periods. This framework makes it easier to compute blood pressure means and variability during specific periods, and filter out periods that aren't part of the intended 24-hour measurement. For example, suppose I had worn the ABPM device for another day and on the second night I slept at different times. If I had only given my sleep diary for the first night, then my second night of ABPM data would be mislabeled! In this case, it would be safer to include only my first night of blood pressure readings.

Value

a numeric vector with values of 0, 1, 2, and so on. A value of 0 indicates that the corresponding x value was not in period_value. A value i > 0 indicates that the corresponding x value was in the ith ABPM period.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
# count awake periods
x <- c("A","A","A","S","S",NA,"A","A")

mark_period(x, "A")
# count awake and asleep periods
x <- c("A","A","A","S","S",NA,"A","A")

# count awake periods, imputing from the right
x <- c("A","A","A","S","S",NA,"A","A")

mark_period(x, c("A","S"), impute_from = 'right')#'

mark_period(x, c("A","S"))

bcjaeger/cleanRbp documentation built on May 26, 2021, 1:03 p.m.