Data Analysis on Crossfit Athletes with R-Shiny

Posted on Jan 3, 2021
The skills I demoed here can be learned through taking Data Science with Machine Learning bootcamp with NYC Data Science Academy.

Weekend (Data) Warrior

For many of us, New Year == New You: a running start to all those exercise, eating and wellbeing programs we never quite got to last year. There's data evidence that the most-common new year's resolution among Americans is to exercise more, and that more healthy living is a goal for almost a third of us.

Like half a million other people around the world, my activity of choice is Crossfit. Although I've been doing it for five years, I resolved this year to increase my Crossfit knowledge, engagement and mojo. Rather than actually go to the gym, I decided to build an interactive R Shiny app that could help me and other Crossfitters to analyze the performance of competitive athletes, looking for patterns that can lead to gains.

The data consisted of two files. (They can be accessed here and here, and previous analyses can be found here and here.) One contained of over 1.5 million records of athlete performance at various Crossfit events, including the annual Open, which attracts hundreds of thousands of people like me with dreams of ESPN Crossfit Games glory. The other file had 423,000 rows of 28 attributes, most of which were self-reported by athletes, including times on standard workouts, weightlifting loads, and answers to survey questions about diet, background, lifestyle and routines.

The data files could be joined on Athlete ID, which is unique to each registered athlete.

Note: If you'd like just like to interact with the app -- it's pretty self-explanatory -- you can jump right to it here.

Motivating Questions

The primary questions I was hoping to answer with the help of the app were:

  • Is there a competitive benefit to focusing on cardio or weightlifting, both of which feature in the Crossfit program?
  • What is the impact of body-mass index (BMI) on the different types of activities?
  • Is there a background or routine that leads to better performance in competitions?

In particular, I wanted to reach some conclusions about how athletes who performed well at sanctioned events trained and focused their time. Someday, I mused, I might be one of them ....

Building the R Shiny App

Data Prep

The primary challenge was missing and suspicious data. The sanctioned event response data was reliable because it was official and simply had to be deduplicated around Athlete ID and checked for missing rows, which were removed.

The self-reported data was a different matter. Many athletes left many responses blank, for various reasons. Because the results are idiosyncratic to the athlete, I did not feel comfortable imputing values. Some data were obvious erroneous -- either entered in error or deliberately fudged. For example, a number of athletes entered times for "running a 400K" that were faster than the world record or slower than a nap. I created a probable range of reasonableness and removed outliers.

Survey questions about diet and lifestyle were self-reported and not ideally structured. They were contained within a single string with multiple responses allowed. For simplicity, I selected the first response.

Building the App

I wanted to have an easy-to-use app that had three tabs. The areas of interest were:

  • Benchmarks: Let an athlete see how their times/loads for various standard workouts compared to others in their cohort.
  • Competitor Benchmarks: Explore how athletes who finished at various levels in ranked competitions did on these same workouts.
  • Lifestyle Factors: Finally, I wanted athletes to be able to see survey responses to questions about diet, training, etc. from athletes who ranked at some chosen level -- in order to compare "winners" vs. "others"

My app used the basic format of ui.R, server.R and global.R. My toggles were related to selecting cohorts. In cohorts, there are divisions made between men and women (for competition and for benchmarking), as well as for adults over and under 35 years old (with 35 yrs + considered a "Masters" athlete). Body-mass index (BMI) is not a competitive variable but is important in gauging individual performance; as you should know, it's a general representation of height/weight proportions.

A design note: I wanted the toggles in the sidebar to be different for each tab, showing only the relevant inputs. I was able to do this by setting up a mainPanel, 3 tabsetPanels and 3 conditionalPanels. Snippets are shown here:

Data Analysis on Crossfit Athletes with R-Shiny

The final UI for the first tab used boxplots to indicate the distribution of the self-reported scores for various benchmark workouts. The workouts themselves are listed at the bottom of the screen. Note that Crossfit gives standard workouts names (like "Fran") and calls them WODs (for Workout-of-the-Day). Yes, you could call it a feel-good cult.

Data Analysis on Crossfit Athletes with R-Shiny

R Shiny App UI

What I Learned about Crossfit

Is there a competitive benefit to focusing on Cardio or Weightlifting?

Running vs. WODs:Β Basically, there is less variability in running ability than there is in weightlifting for various cohorts. This makes intuitive sense: running is more of a general marker of cardio health than weightlifting, which requires both health and specific skill in the movement.

Weightlifting:Β There are more outliers on the high-end in the hard-core weightlifting events. So there seems to be a more concentrated group of gifted lifters than there are people who are generally good at endurance. This again points to the importance of improving weightlifting vs. cardio for competitive excellence.

Elites: Speaking of elites, there is definitely a bright line between the top 10K or so athletes and the rest of us -- they regularly outperform in competition and run us ragged. So only those in the top 10K or so (which is, say, the top 4-5% of serious Crossfitters) are elite. This separation is even more pronounced among women.

Data on the Impact of BMI on Different Types of Activities

BMI:Β It's the most important factor we have in the data. Surprisingly, BMI has more impact on performance than age or gender. Remember that BMI is simply an indication of how "dense" your body is -- it's possible to have an outsized BMI (above the mean for your age/gender) by being obese or by being heavily muscled. So it's not equivalent to being out of shape. The data bears this up: higher BMIs predicted lower cardio scores but higher weightlifting scores.

Older Athletes:Β Based on survey responses, older athletes (35+) were more careful with their diets and were even less likely to perform well with a higher BMI index. The lesson here is that while BMI is critical in all age groups, it gets more important with age to stay relatively lean.

Is there a supporting data background or routine that leads to better performance?

Background: Both men and women who performed well at Crossfit events quite often started working out alone (with no coach), and many have only been doing Crossfit for a couple of years. So the lesson is it's okay to start small and don't assume you need years of experience to win.

Secret: The single lifestyle factor that seemed to have the biggest impact on performance was simple: the number of workouts per week. Better athletes work out more often than also-rans. It's an old story but apparently true: work it, it's worth it.


The Shiny app itself can be enjoyed here

Happy WOD'ing!

About Author

Martin Kihn

SVP Strategy, Salesforce Marketing Cloud - formerly VP Research at Gartner, covering data-driven marketing, marketing and advertising analytics and data management platforms. Interested in ad tech, measurement and digital advertising and marketing. Author and balletomane.
View all posts by Martin Kihn >

Related Articles

Leave a Comment

No comments found.

View Posts by Categories

Our Recent Popular Posts

View Posts by Tags

#python #trainwithnycdsa 2019 2020 Revenue 3-points agriculture air quality airbnb airline alcohol Alex Baransky algorithm alumni Alumni Interview Alumni Reviews Alumni Spotlight alumni story Alumnus ames dataset ames housing dataset apartment rent API Application artist aws bank loans beautiful soup Best Bootcamp Best Data Science 2019 Best Data Science Bootcamp Best Data Science Bootcamp 2020 Best Ranked Big Data Book Launch Book-Signing bootcamp Bootcamp Alumni Bootcamp Prep boston safety Bundles cake recipe California Cancer Research capstone car price Career Career Day citibike classic cars classpass clustering Coding Course Demo Course Report covid 19 credit credit card crime frequency crops D3.js data data analysis Data Analyst data analytics data for tripadvisor reviews data science Data Science Academy Data Science Bootcamp Data science jobs Data Science Reviews Data Scientist Data Scientist Jobs data visualization database Deep Learning Demo Day Discount disney dplyr drug data e-commerce economy employee employee burnout employer networking environment feature engineering Finance Financial Data Science fitness studio Flask flight delay gbm Get Hired ggplot2 googleVis H20 Hadoop hallmark holiday movie happiness healthcare frauds higgs boson Hiring hiring partner events Hiring Partners hotels housing housing data housing predictions housing price hy-vee Income Industry Experts Injuries Instructor Blog Instructor Interview insurance italki Job Job Placement Jobs Jon Krohn JP Morgan Chase Kaggle Kickstarter las vegas airport lasso regression Lead Data Scienctist Lead Data Scientist leaflet league linear regression Logistic Regression machine learning Maps market matplotlib Medical Research Meet the team meetup methal health miami beach movie music Napoli NBA netflix Networking neural network Neural networks New Courses NHL nlp NYC NYC Data Science nyc data science academy NYC Open Data nyc property NYCDSA NYCDSA Alumni Online Online Bootcamp Online Training Open Data painter pandas Part-time performance phoenix pollutants Portfolio Development precision measurement prediction Prework Programming public safety PwC python Python Data Analysis python machine learning python scrapy python web scraping python webscraping Python Workshop R R Data Analysis R language R Programming R Shiny r studio R Visualization R Workshop R-bloggers random forest Ranking recommendation recommendation system regression Remote remote data science bootcamp Scrapy scrapy visualization seaborn seafood type Selenium sentiment analysis sentiment classification Shiny Shiny Dashboard Spark Special Special Summer Sports statistics streaming Student Interview Student Showcase SVM Switchup Tableau teachers team team performance TensorFlow Testimonial tf-idf Top Data Science Bootcamp Top manufacturing companies Transfers tweets twitter videos visualization wallstreet wallstreetbets web scraping Weekend Course What to expect whiskey whiskeyadvocate wildfire word cloud word2vec XGBoost yelp youtube trending ZORI