Learn R Programming

pawacc (version 1.1)

dateSummary: Date summary for accelerometer files

Description

This function provides a date summary for Actigraph GT1M accelerometer files.

Usage

dateSummary(object, wear, timestamp, minval = 0,
rescale.epoch = 60, keep.error = FALSE)

Arguments

object
an object of class gt1m.
wear
a vector that classifies wear and non-wear time. See markwear.accfile.
timestamp
a timestamp vector for accelerometer values that can be provided by tsFormat.
minval
threshold defining the minimum number of minutes to identify first and last days. See details.
rescale.epoch
epoch expressed in the same unit as acceleromenter's epoch to determine minutes of wear time (default is 60 and assumed to be in seconds).
keep.error
logical flag. If FALSE (default) data errors as identified by errorCts will be replaced by NAs.

Value

  • A data frame containing the following variables
  • fileidfile identifier
  • daysdates by calendar day
  • freqfrequency of accelerometer observations in each day
  • hour_daytotal hours of accelerometer observations in each day
  • start_daystarting time of accelerometer observations
  • endend time of accelerometer observations
  • valid_minswear time (minutes)
  • IsStartDatedummy variable to define starting date (1 = yes)
  • IsEndDatedummy variable to define end date (1 = yes)
  • IsTruncateddummy variable to define truncated date (1 = yes)

Details

Based on total wear time (in minutes) for each day, the theshold minval is applied to identify the first and last days. For example, if accelerometers are sent by post to collect survey data, the first and last days in which the accelerometer was worn might not be known. Days before the first and those after the last day (truncated days) are discarded by collapse.accfile.

References

Geraci M, Rich C, Sera F, Cortina-Borja M, Griffiths LJ, and Dezateux C (2012). Technical report on accelerometry data processing in the Millennium Cohort Study. London, UK: University College London. Available at http://discovery.ucl.ac.uk/1361699

See Also

collapse.accfile

Examples

Run this code
data(gt1m_sample)

mw <- markwear.accfile(gt1m_sample, 20)
tsf <- tsFormat(gt1m_sample)
dateSummary(gt1m_sample, mw, tsf)
fileid       days freq hour_day start_day end_day valid_mins IsStartDate
1   test 2011-12-08 3840   16.000        08      23     571.25           1
2   test 2011-12-09 5760   24.000        00      23     557.00           0
3   test 2011-12-10 5760   24.000        00      23     676.50           0
4   test 2011-12-11 5760   24.000        00      23     493.50           0
5   test 2011-12-12 5760   24.000        00      23     638.25           0
6   test 2011-12-13 5760   24.000        00      23     680.50           0
7   test 2011-12-14 5760   24.000        00      23     717.00           0
8   test 2011-12-15 5760   24.000        00      23       0.50           0
9   test 2011-12-16  750    3.125        00      03       0.00           0
  IsEndDate IsTruncated
1         0           0
2         0           0
3         0           0
4         0           0
5         0           0
6         0           0
7         0           0
8         0           0
9         1           0

# at least 600 minutes per day to determine first and last day
dateSummary(gt1m_sample, mw, tsf, minval = 600)
fileid       days freq hour_day start_day end_day valid_mins IsStartDate
1   test 2011-12-08 3840   16.000        08      23     571.25           0
2   test 2011-12-09 5760   24.000        00      23     557.00           0
3   test 2011-12-10 5760   24.000        00      23     676.50           1
4   test 2011-12-11 5760   24.000        00      23     493.50           0
5   test 2011-12-12 5760   24.000        00      23     638.25           0
6   test 2011-12-13 5760   24.000        00      23     680.50           0
7   test 2011-12-14 5760   24.000        00      23     717.00           0
8   test 2011-12-15 5760   24.000        00      23       0.50           0
9   test 2011-12-16  750    3.125        00      03       0.00           0
  IsEndDate IsTruncated
1         0           1
2         0           1
3         0           0
4         0           0
5         0           0
6         0           0
7         1           0
8         0           1
9         0           1

Run the code above in your browser using DataLab