Skip to contents

Read ActiGraph sleep watch data from an SQLite database stored in an AGD file and return a list with (at least) five tables: data, sleep, filters, settings, awakenings. The tables have the schema described in the ActiLife 6 User manual and the timestamps are converted from Unix time format to human-readable POSIXct representation. Code is from actigraph.sleepr package https://github.com/dipetkov/actigraph.sleepr/. See LICENCE.note file in the app skeleton.

Usage

read_agd_raw(file, tz = "UTC")

Arguments

file

Full path to an agd file to read.

tz

Time zone to convert DateTime ticks to POSIX time.

Value

A list of five tables: settings, data, filters, sleep, awakenings and, if available, capsense.

Details

Some ActiGraph devices contain a capacitive sensor to detect monitor removal when worn against the skin. If that data is available, the return list includes a capsense table as well.

References

ActiLife 6 User's Manual by the ActiGraph Software Department. 04/03/2012.

covertagd: R package for converting agd files from ActiGraph into data.frames.

See also

Examples

file <- system.file("extdata", "acc.agd",
  package = "activAnalyzer"
)
str(read_agd_raw(file))
#> List of 6
#>  $ data      : tibble [41,400 × 10] (S3: tbl_df/tbl/data.frame)
#>   ..$ dataTimestamp  : POSIXct[1:41400], format: "2021-04-07 06:00:00" "2021-04-07 06:00:10" ...
#>   ..$ axis1          : num [1:41400] 0 0 0 0 0 0 0 0 0 0 ...
#>   ..$ axis2          : num [1:41400] 0 0 0 0 0 0 0 0 0 0 ...
#>   ..$ axis3          : num [1:41400] 0 0 0 0 0 0 0 0 0 0 ...
#>   ..$ steps          : num [1:41400] 0 0 0 0 0 0 0 0 0 0 ...
#>   ..$ lux            : num [1:41400] 0 0 0 0 0 0 0 0 0 0 ...
#>   ..$ inclineOff     : num [1:41400] 10 10 10 10 10 10 10 10 10 10 ...
#>   ..$ inclineStanding: num [1:41400] 0 0 0 0 0 0 0 0 0 0 ...
#>   ..$ inclineSitting : num [1:41400] 0 0 0 0 0 0 0 0 0 0 ...
#>   ..$ inclineLying   : num [1:41400] 0 0 0 0 0 0 0 0 0 0 ...
#>  $ sleep     : tibble [0 × 10] (S3: tbl_df/tbl/data.frame)
#>   ..$ inBedTimestamp : 'POSIXct' num(0) 
#>  - attr(*, "tzone")= chr ""
#>   ..$ outBedTimestamp: 'POSIXct' num(0) 
#>  - attr(*, "tzone")= chr ""
#>   ..$ sleepID        : int(0) 
#>   ..$ timeAsleep     : int(0) 
#>   ..$ timeAwake      : int(0) 
#>   ..$ awakenings     : int(0) 
#>   ..$ wakeAfterOnset : int(0) 
#>   ..$ latency        : int(0) 
#>   ..$ efficiency     : num(0) 
#>   ..$ totalCounts    : int(0) 
#>  $ filters   : tibble [5 × 3] (S3: tbl_df/tbl/data.frame)
#>   ..$ filterStartTimestamp: POSIXct[1:5], format: "2021-04-07 09:11:00" "2021-04-08 07:25:00" ...
#>   ..$ filterStopTimestamp : POSIXct[1:5], format: "2021-04-07 21:11:00" "2021-04-08 20:56:00" ...
#>   ..$ filterID            : int [1:5] 1 2 3 4 5
#>  $ settings  : tibble [37 × 3] (S3: tbl_df/tbl/data.frame)
#>   ..$ settingID   : int [1:37] 1 2 3 4 5 6 7 8 9 10 ...
#>   ..$ settingName : chr [1:37] "softwarename" "softwareversion" "osversion" "machinename" ...
#>   ..$ settingValue: chr [1:37] "ActiLife" "6.13.3" "Microsoft Windows NT 10.0.18363.0" "APCOSS-PC06" ...
#>  $ awakenings: tibble [0 × 4] (S3: tbl_df/tbl/data.frame)
#>   ..$ timestamp  : 'POSIXct' num(0) 
#>  - attr(*, "tzone")= chr ""
#>   ..$ awakeningID: int(0) 
#>   ..$ sleepID    : int(0) 
#>   ..$ length     : int(0) 
#>  $ capsense  : tibble [6,900 × 5] (S3: tbl_df/tbl/data.frame)
#>   ..$ timeStamp: POSIXct[1:6900], format: "2021-04-07 06:00:00" "2021-04-07 06:01:00" ...
#>   ..$ signal   : int [1:6900] 601 602 602 602 602 602 602 602 602 602 ...
#>   ..$ reference: int [1:6900] 601 602 602 602 602 602 602 602 602 602 ...
#>   ..$ state    : int [1:6900] 0 0 0 0 0 0 0 0 0 0 ...
#>   ..$ bursts   : int [1:6900] 10 10 10 10 10 10 10 10 10 10 ...