Skip to contents

In this cook book you will find recipes for using GGIR in specific non-default scenarios.

Handling externally derived data

This refers to the situation where external software or hardware was used to derive epoch level aggregates from accelerometer data.

Actiwatch data

in .AWD format

GGIR(datadir = "/media/actiwatch_awd", # folder with epoch level .AWD file
  outputdir = "/media/myoutput",
  dataFormat = "actiwatch_awd",
  extEpochData_timeformat = "\%m/\%d/\%Y \%H:\%M:\%S",
  windowsizes = c(60, 900, 3600), # 60 is the expected epoch length
  HASIB.algo = "Sadeh1994",
  def.noc.sleep = c()) # <= because we cannot use HDCZA for ZCY

in .CSV format

GGIR(datadir = "/media/actiwatch_csv", # folder with epoch level .AWD file
  outputdir = "/media/myoutput",
  dataFormat = "actiwatch_csv",
  extEpochData_timeformat = "\%m/\%d/\%Y \%H:\%M:\%S",
  windowsizes = c(15, 900, 3600), # 15 is the expected epoch length
  HASIB.algo = "Sadeh1994",
  def.noc.sleep = c()) # <= because we cannot use HDCZA for ZCY

UK Biobank data in .CSV format

This is only applicable the UK Biobank 5 second epoch csv exports and NOT to the raw accelerometer data. Please see https://wadpac.github.io/GGIR/ for all documentation on processing raw accelerometer data (multiple values per second).

GGIR(datadir = "/media/ukbiobank",
   outputdir = "/media/myoutput",
   dataFormat = "ukbiobank_csv",
   extEpochData_timeformat = "\%m/\%d/\%Y \%H:\%M:\%S",
   windowsizes = c(5, 900, 3600), # We know that data was stored in 5 second epoch
   desiredtz = "Europe/London") # We know that data was collected in the UK

ActiGraph count data in .CSV format

GGIR(datadir = "/examplefiles",
   outputdir = "",
   dataFormat = "actigraph_csv",
   windowsizes = c(5, 900, 3600),
   threshold.in = round(100 * (5/60), digits = 2),
   threshold.mod = round(2500 * (5/60), digits = 2),
   threshold.vig = round(10000 * (5/60), digits = 2),
   extEpochData_timeformat = "\%m/\%d/\%Y \%H:\%M:\%S",
   do.neishabouricounts = TRUE,
   acc.metric = "NeishabouriCount_x")

Senwear data in .xls format

GGIR(datadir = "C:/yoursenseweardatafolder",
    outputdir = "D:/youroutputfolder",
    windowsizes = c(60, 900, 3600),
    threshold.in = 1.5,
    threshold.mod = 3,
    threshold.vig = 6,
    dataFormat = "sensewear_xls",
    extEpochData_timeformat = "\%d-\%b-\%Y \%H:\%M:\%S",
    HASPT.algo = "NotWorn")

Handling study protocol

Not worn during night

Data type: Any Study protocol: Worn during the day, taken off during the night Wear location: Any

GGIR(HASPT.algo = c("NotWorn", "HDCZA"),
    HASIB.algo = "vanHees2015",
    do.imp = FALSE, # Do not impute nonwear because sensor was never worn 24/7
    HASPT.ignore.invalid = NA, # Treat nonwear as potential part of guider window
    ignorenonwear = FALSE, # Consider nonwear as potential sleep
    includenightcrit = 8,
    includedaycrit = 8)

If “NotWorn” is specified then a second guider can be supplied to the same parameter as shown above. This second guider will be used if the accelerometer is worn for more than 75 percent of the night. The example above shows this for HDCZA.