summarize_actigraphy: Summarize Actigraphy Data

Description Usage Arguments Value Examples

View source: R/create_day_data.R

Description

Summarize Actigraphy Data

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
summarize_daily_actigraphy(
  x,
  units = "1 min",
  fix_zeros = TRUE,
  fill_in = TRUE,
  verbose = TRUE,
  ...
)

summarise_daily_actigraphy(
  x,
  units = "1 min",
  fix_zeros = TRUE,
  fill_in = TRUE,
  verbose = TRUE,
  ...
)

summarize_actigraphy(
  x,
  units = "1 min",
  .fns = list(mean = mean, median = median),
  verbose = TRUE,
  ...
)

summarise_actigraphy(
  x,
  units = "1 min",
  .fns = list(mean = mean, median = median),
  verbose = TRUE,
  ...
)

Arguments

x

an AccData object. If 'x' is a character, then read_actigraphy will be run

units

units to group the data to take the statistic over

fix_zeros

Should fix_zeros be run before calculating the measures?

fill_in

if fix_zeros = TRUE, should the zeros be filled in with the last observation carried forward?

verbose

print diagnostic messages

...

Additional arguments to pass to read_actigraphy

.fns

Functions to apply to each of the selected columns. See across

Value

A tsibble object, with 86400 rows, with one row for each secon d of the day '24*60*60'.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
url = "https://github.com/THLfi/read.gt3x/files/3522749/GT3X%2B.01.day.gt3x.zip"
destfile = tempfile(fileext = ".zip")
dl = utils::download.file(url, destfile = destfile)
gt3x_file = utils::unzip(destfile, exdir = tempdir())
gt3x_file = gt3x_file[!grepl("__MACOSX", gt3x_file)]
path = gt3x_file

x = read_actigraphy(path)

library(dplyr)
library(lubridate)
options(digit.secs = 2)

daily = summarize_daily_actigraphy(x)
average_day = summarize_actigraphy(x)
## Not run: 
if (requireNamespace("ggplot2", quietly = TRUE)) {
library(magrittr)
average_day %>%
  ggplot(aes(x = time, y = ai_mean)) +
  geom_line()

average_day %>%
  ggplot(aes(x = time, y = ai_median)) +
  geom_line()
}

## End(Not run)

oslerinhealth/SummarizedActigraphy documentation built on Aug. 20, 2020, 2:21 a.m.