Closed pbaylis closed 6 months ago
Following up, this seems to be some sort of corruption issue with some of my .FIT files. So fixing it in this package may be out of scope. Fortunately there is a pretty straightforward workaround: Garmin provides a Java tool that can repair these files. I ran it on this one and had no trouble importing the repaired version.
I finally got round to fixing this. It was also reported in #41 with another file from a Coros watch. It seems the 'start' event i.e. when you press start on the watch, has a data field that doesn't actually contain any values. That package wasn't expecting this and would try to use the 'nothing' and fail.
For now I've included an NA
value in this place as you can see below.
library(FITfileR)
## download and extract the example file
destfile = tempfile(fileext = ".zip")
url = "https://github.com/grimbough/FITfileR/files/13468357/Ecola_Beach_morning.fit.zip"
dl = download.file(url = url, destfile = destfile)
example_file = unzip(destfile, exdir = tempdir())
## read and extract the events
fitFile <- readFitFile(example_file[1])
events(fitFile)
#> $event_1
#> # A tibble: 3 × 4
#> timestamp event event_type event_group
#> <dttm> <chr> <chr> <int>
#> 1 2021-06-30 16:07:22 timer start 0
#> 2 2021-06-30 16:25:24 timer stop_all 0
#> 3 2021-06-30 16:47:33 timer stop_all 0
#>
#> $event_2
#> # A tibble: 1 × 5
#> timestamp event event_type event_group data
#> <dttm> <chr> <chr> <int> <lgl>
#> 1 2021-06-30 16:29:04 timer start 0 NA
Hi, this is a great package. Thank you for writing it.
I am having trouble loading some of the .fit files Strava produces, such as the one from this activity. I'm including a minimum example to document the issue and have attached a compressed version of the .fit file below.
Ecola_Beach_morning.fit.zip
And here is my
sessionInfo()
: