readAxivity: Function to read .cwa-format files as produced by the...

View source: R/readAxivity.R

readAxivityR Documentation

Function to read .cwa-format files as produced by the accelerometer named 'Axivity'

Description

For reading .cwa-format data with the Axivity AX3 and AX6 sensors.

Usage

  readAxivity(filename, start = 0, end = 0, progressBar = FALSE, 
    desiredtz = "", configtz = c(), interpolationType=1, loadbattery = FALSE,
    header = NULL, frequency_tol = 0.1, maxAllowedCorruptBlocks = 20)

Arguments

filename

filename (required) is name of cwa file to read

start

non-negative integer which is a cwa file block number.

end

non-negative integer which is a cwa file block number. End must be not be less than start. If end is less or equal to start, then there is no data read.

progressBar

Is trigger to switch on/off the text progress bar. If progressBar is TRUE then the function displays the progress bar but it works slightly slower

desiredtz

Desired timezone, a character with timezone database name.

configtz

Timezone in which the accelerometer was configured. Only use this argument if the timezone of configuration and timezone in which recording took place are different.

interpolationType

Integer to indicate type of interpolation to be used, 1=linear, 2=nearest neighbour.

loadbattery

Boolean to indicate whether battery voltage should be loaded

header

Header to be reused if it was extracted earlier

frequency_tol

Numeric value representing the tolerance for frequency bias expressed as a fraction of the expected sampling frequency. For example, 0.10 indicates that we accept the sampling frequency configured at 100 Hertz to vary between 90 and 110 Hertz. If this condition is not met the data will be imputed with a constant value and the start and end time will be logged in the QClog output object. Regardless of the setting the function will always log instances when frequency differs by more than 5%, but if this is less than frequency_tol the block will not be imputed.

maxAllowedCorruptBlocks

Max number of consecutive blocks with a failed checksum that we'll tolerate.

Value

  • data dataframe with data from start inclusive till end exclusive. If start == end then data section of final structure is empty.

    • timestamp in numeric format

    • gx gyroscope x-axis (only available in AX6)

    • gy gyroscope y-axis (only available in AX6)

    • gz gyroscope z-axis (only available in AX6)

    • x accelerometer x-axis

    • y accelerometer y-axis

    • z accelerometer z-axis

    • temperature in Celsius (only recorded once per block)

    • battery one value per block (only recorded once per block)

    • light in LUX on (only recorded once per block)

  • header file header. list of header information:

    • uniqueSerialCode is unque serial code of used device

    • frequency is measurement frequency. All data will be resampled for this frequency

    • start is timestamp in numeric form. To get text representation it is enough to use as.POSIXct(start, origin = "1970-01-01", tz=desiredtz)

    • device is "Axivity"

    • firmwareVersion

    • blocks is number of datablocks with 80 or 120 raw observations in each.

  • QClog dataframe with log of integrity checks on each block including:

    • checksum_pass Boolean to indicate whether checksum was zero.

    • blockID_previous ID for previous block

    • blockID_current ID for current block

    • start_previous numeric start time of previous block

    • start_current numeric start time of current block

    • blockLengthSeconds length of previous block

    • frequency_blockheader frequency derived from block header

    • frequency_observed frequency as observed

    • imputed Boolean to indicate whether this block was inputed

Author(s)

Evgeny Mirkes <em322@leicester.ac.uk> Lena Kushleyeva Vincent van Hees <v.vanhees@accelting.com>

Examples

  
    cwafile  = system.file("testfiles/ax3_testfile.cwa", package = "GGIRread")[1]
    AX3 = readAxivity(filename = cwafile, desiredtz = "Europe/Berlin", start = 1, end = 2)
  

GGIRread documentation built on Oct. 25, 2024, 5:06 p.m.