Running Around: an R package to analyse Garmin running data

Wait 5 sec.

[This article was first published on Rstats – quantixed, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.In my previous post, I shared my annual running stats which were generated in R using summary data from Garmin Connect. The code I use to generate these summaries was beginning to get a bit unwieldy, so I have now rebased it into a package.GarminCSVr – is an R package to look at running data using the activity summaries that can be downloaded from the Garmin Connect website. This post is to show what the package can do.Annual summaryThere are two main workflows. The first – summarise_activities() – is designed to provide an annual summary of running data, with an annual distance goal in mind. See below on how to organise the Garmin data prior to running the code.# install.packages("devtools")devtools::install_github("quantixed/GarminCSVr")library(GarminCSVr)## my 2025 running goal was 3650 kmsummarise_activities(from = "2025-01-01", to = "2025-12-31", annual = 3650)This generates these plots to visualise the progress:Eagled-eyed readers may note that I have also updated the calendar view of runs per day and distance per day to make it easier to interpret.Comparing years of activitiesIn the second function – compare_years() – we can compare annual running year on year.# compare 2018 through to 2025compare_years(from = "2018-01-01", to = "2025-12-31")This function also outputs some heart rate data that I’m not posting here.UsageCurrently, Activities in Garmin Connect can be accessed and filtered for running as shown in the screenshot. This link currently gets you to the correct screen but might change in the future.Clicking on Export CSV allows the download of all displayed activities. Scrolling down loads more and more past activities enabling the export of everything if you go back far enough.Grabbing this CSV summary is more simple than wrangling with the API. If you grab all your past activities and then subsequently download the last few weeks/months, you can add all the CSV files into a folder and {GarminCSVr} will deal with any duplications.If you’re working in a clean RStudio project, place the files in a folder called Data within the project and the code will run automatically and save the plots into Output/Data in the project/working directory. The files could be somewhere else, you just need to tell GarminCSVr where to find them using the datadir argument.The package is designed for running but should work with cycling or swimming. Just change the activity argument and you should be good to go.Finally, if you want to try out GarminCSVr but don’t have any files, I have included some dummy data. Just run:# devtools::install_github("quantixed/GarminCSVr")library(GarminCSVr)# example data included in the package# summarise activities for 2025 with a target of 1500 kmsummarise_activities(datadir = system.file("extdata",package = "GarminCSVr"), from = "2025-01-01", to = "2025-12-31", target = 1500)# comparison of years using the example datacompare_years(datadir = system.file("extdata",package = "GarminCSVr"))—The post title is taken from “Running Around” by D.R.I.To leave a comment for the author, please follow the link and comment on their blog: Rstats – quantixed.R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.Continue reading: Running Around: an R package to analyse Garmin running data