How to unify all record messages
lindig opened this issue · comments
This is probably more an R question (where I lack experience). I am processing FIT files from Garmin watches that are recorded during rowing. The cadence
value denotes the strokes per minute, which goes to 0 when the boat stops. This leads to what you describe: the record message has multiple definitions - with and without cadence. But I believe it is still useful to consider all records just in the order they are recorded and not being split across data frames. How would one achieve this?
Examples for FIT files from rowing: https://github.com/lindig/fit/tree/main/data
The code above is my simple FIT reader that, when not used as a library, translates FIT to JSON but is not as comprehensive as yours in decoding the various messages and also ignores developer fields.
I'm afraid I don't have access to a computer at the moment, but can you do something like this to get all the records, combine them and then arrange by timestamp?
garmin <- readFitFile()
garmin_records <- records(garmin) %>%
bind_rows() %>%
arrange(timestamp)
Thank you - will try this. I don't have my R environment around to try this immediately.