Methods for retrieving messages from FitFile-class objects.

listMessageTypes(fitFile)

# S4 method for FitFile
listMessageTypes(fitFile)

getMessagesByType(fitFile, message_type)

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

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

# S4 method for FitFile
messages(fitFile)

file_id(fitFile)

# S4 method for FitFile
file_id(fitFile)

records(fitFile)

# S4 method for FitFile
records(fitFile)

laps(fitFile)

# S4 method for FitFile
laps(fitFile)

events(fitFile)

# S4 method for FitFile
events(fitFile)

hrv(fitFile)

# S4 method for FitFile
hrv(fitFile)

monitoring(fitFile)

# S4 method for 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.

Value

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

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.