FitFile-accessors: Extracting messages from FIT Files

FitFile-accessorsR Documentation

Extracting messages from FIT Files

Description

Methods for retrieving messages from FitFile-class objects.

Usage

listMessageTypes(fitFile)

## S4 method for signature 'FitFile'
listMessageTypes(fitFile)

getMessagesByType(fitFile, message_type)

## S4 method for signature 'FitFile,integer'
getMessagesByType(fitFile, message_type)

## S4 method for signature 'FitFile,character'
getMessagesByType(fitFile, message_type)

## S4 method for signature 'FitFile'
messages(fitFile)

file_id(fitFile)

## S4 method for signature 'FitFile'
file_id(fitFile)

records(fitFile)

## S4 method for signature 'FitFile'
records(fitFile)

laps(fitFile)

## S4 method for signature 'FitFile'
laps(fitFile)

events(fitFile)

## S4 method for signature 'FitFile'
events(fitFile)

hrv(fitFile)

## S4 method for signature 'FitFile'
hrv(fitFile)

monitoring(fitFile)

## S4 method for signature 'FitFile'
monitoring(fitFile)

Arguments

fitFile

A FitFile-class object.

message_type

Either an integer or character vector (length 1), specifying either a global message number or message type respectively.

Details

The FIT file specification allows for a large number of message types. FITfileR provides accessor methods for some of the most common. These include records() and laps().

If a predefined function doesn't exist for the message type you want to extract, any message type can be retrieved with getMessagesByType. The second argument can take either the global message number (as specified in the FIT File definition) of message type you want, or the message name. A list of names for the message types held in a FitFile-class object can be retrieved with listMessageTypes.

The return type is dependant upon whether the FitFile-class contains multiple message definitions for the same message type. It is not uncommon for this to occur e.g. if a new sensor is added during an activity the records field definition will change. If there is a single definition for the message type a tibble will be returned, otherwise a list of tibbles is returned. The length of this list reflects the number of unique definitions for the message type within the file. It may be straightforward to combine these tibbles e.g. via rbind, but this is left to the user.

Value

Either a tibble or a list of tibble. See details for more information.


grimbough/fitFileR documentation built on April 24, 2024, 12:07 a.m.