Logo

The Data Daily

Form and File: estimating running form in R | R-bloggers

Form and File: estimating running form in R | R-bloggers

Form and File: estimating running form in R
Posted on November 5, 2022 by quantixed in R bloggers | 0 Comments
[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.
There are lots of ways for runners and cyclists to analyse training data. A key question most fitness enthusiasts want to know is “how am I doing?”.
“How you are doing” is referred to as form.
Unsurprisingly, form can be estimated in many ways. One method is using training stress scores (acute training load and chronic training load) to assess form as training stress balance. The acronyms for these terms are apparently copyrighted(!) by TrainingPeaks. So I will refer to acute training load as fatigue, chronic training load as fitness and the training stress balance as form. Some notes on how these are calculated can be found lower down.
Let’s calculate these scores for running using R.
The plots above show my scores for this year so far. Because of the way that these scores are calculated it takes 7 days to get a meaningful Fatigue score and 42 days for a meaningful Fitness score, i.e. the calculation starts at 0 on New Year’s Day, when in reality, I carried over fitness and fatigue from December. Nonetheless this is a good way of tracking Form.
So what does it tell us? This year I spent a lot of time in the Grey zone, only nudging into the Optimal zone during intense activity. This is because my basal activity (and therefore fitness) is quite high. This means I need to do periodisation if I want to target improvement. This is where the runner interleaves intense periods (blocks) with less active spells.
How to calculate the data
Using summary data from Garmin connect (downloadable as CSV), a runner’s average heart rate and run time for a given activity date is all that is needed to do the calculation.
## The aim of this script is to load and process CSV data from the Garmin Connect website. ## This script will load all csv files in Data/ (in current wd) and filter for Running (and Treadmill Running) ## Place one or more Garmin CSV outputs into the Data folder for inclusion. Dates for activities can be overlapping ## duplicates are dealt with, so you can just keep adding csvs with the latest data and use the script again. ## Use of `find_form(from, to)` enables the user to examine their running form within the specified window. require(ggplot2) require(hms) library(reshape2) library(patchwork) ## Setup preferred directory structure in wd ifelse(!dir.exists("Data"), dir.create("Data"), "Folder exists already") ifelse(!dir.exists("Output"), dir.create("Output"), "Folder exists already") ifelse(!dir.exists("Output/Data"), dir.create("Output/Data"), "Folder exists already") ifelse(!dir.exists("Output/Plots"), dir.create("Output/Plots"), "Folder exists already") ifelse(!dir.exists("Script"), dir.create("Script"), "Folder exists already") ## functions getWindowActivities

Images Powered by Shutterstock