GGIR-package: A package to process multi-day raw accelerometer data

Description Details Author(s) References Examples

Description

GGIR is an R-package to process multi-day raw accelerometer data. It was developed in the context of research on human daily physical activity with wearable tri-axial acceleration sensors. The term raw accelerometry refers to data being expressed in m/s2 or gravitational acceleration as opposed to the previous generation accelerometers which stored only processed summary measures.

The package has been developed with and for the accelerometer brands Genea and Geneactive. Additionally, it should work for .csv data from Geneactiv, .csv data from Actigraph, and .wav format from Axivity. Although, I have tested this less thoroughly compared with the binary data formats from Genea and Geneactiv.
Note for Actigraph users: please do not export timestamps to the csv-file as this causes memory issues. To cope with the absense of timestamps the code will re-caculate timestamps from the sample frequency and the start time and date as presented in the file header.

Function g.inspectfile assessess to which monitor brand the file belongs and extracts the file header; function g.calibrate helps to investigate calibration error based on free-living data and proposes correction factors; function g.getmeta extracts the signal features; g.impute takes that information, identifies unreliable signal sections (e.g. monitor not worn or signal clips near its extreme) and replaces these sections by imputed values; and finally g.analyse takes the output from all the functions, runs a basic descriptive analysis and then summarises the output both per measurement and per day of measurement.

To enhance the feasibility of using these individual functions I am providing a couple of shell functions to ease implementing the above functions in study data by less experienced R-users. Here, the main shell function is g.shell.GGIR and allows for automating the full analysis of a dataset including all necessary calls to the functions above. Function g.shell.GGIR relies on functions g.part1 and g.part2 also part of this package. In summary, the user is expected to specify the location of the acceleerometer data and the desired output folder. Next, data is loaded and pre- processed with g.getmeta and g.calibrate. Next, the output is converted to a conveniently portable .RData-format away from the R workspace. Next, these .RData files are used as input for g.part2.

Note that g.part1 generates a folder structure to help the user keep track of various output files and milestone data. The folder structure entails: One master folder with a name output_xx where xx is equal to the name of the original data folder. Inside the output_xx folder there will be one folder named meta including all the milestone and a folder results with all the results. Inside the meta folder the following subfolders are created: basic, ms2.out, ms3out, ms4out, and ms5out for respectively g.part1, g.part2, g.part3, g.part4, and g.part5 milestone data.

The reason why g.part1 and g.part2 are not merged as one generic shell function is because g.part1 takes much longer to run and involves only minor decisions of interest to the movement scientist. Function g.part2 on the other hand is relatively fast and comes with all the decisions that directly impact on the variables that are of interest to the movement scientist. Therefore, the user may want to run g.part1 overnight or on a computing cluster, while g.part2 can then be the main playing ground for the movement scientist. So, function g.shell.GGIR basically is the central point for operating both g.part1 and g.part2 and most users should not really need to interact with g.part1 or g.part2 directly. More recently I expanded the package with g.part3 and g.part4 which provide functionality for estimating sleep and sustained inactivity bouts.

g.part5 finally takes the output from parts 2 and 4 to describe time spent between waking up in the morning and waking up the next day subdivided by behavioural category. g.part5 calculates for each of these categories the time spent, the number of bouts, the average acceleration and the number of blocks.

If you want to use this package for a different data format (e.g. from a different accelerometer brand) then please provide me with: the R-code to read the data and example files for testing purposes.

Please note that there is google discussion group for this package (link below).

You can thank me for sharing the code in this package and for developing it as a generic purpose tool by citing the package name and by citing the supporting publications in your own scientific journal/conference publications.

Details

Package: GGIR
Type: Package
Version: 1.4
Date: 2017-1-22
License: LGPL (>= 2.0, < 3)
Discussion group: https://groups.google.com/forum/#!forum/rpackageggir

Author(s)

References

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
## Not run: 
  #inspect file:
  I = g.inspectfile(datafile)
  
  #autocalibration:
  C = g.calibrate(datafile)
  
  #get meta-data:
  M = g.getmeta(datafile)

## End(Not run)
data(data.getmeta)
data(data.inspectfile)
data(data.calibrate)

#impute meta-data:
IMP = g.impute(M = data.getmeta, I = data.inspectfile)
#analyse and produce summary:
A = g.analyse(I = data.inspectfile, C = data.calibrate, M = data.getmeta, IMP)
#plot data
g.plot(IMP, M = data.getmeta, I = data.inspectfile, durplot=4)

ucl-cls/mcs-acc documentation built on May 3, 2019, 2:22 p.m.