Do You Like Stretching? I Would Reconsider!

R
Data Visualization
Plotly
Stretching enhances flexibility but lacks muscle-building benefits. Weight training and resistance exercises stimulate muscle growth. Supplement, not substitute, for effective muscle building.
Author

Brian Cervantes Alvarez

Published

February 24, 2023

Modified

April 8, 2025

Yapper Labs | AI Summary Model: ChatGPT o3-mini-high

I imported and cleaned a gym dataset using tidyverse to properly factorize variables, remove missing values, and prepare the data for analysis. I then computed mean workout ratings by exercise type and experience level and created interactive Plotly visualizations with a custom ggplot theme to rank these exercises. My analysis revealed that while stretching improves flexibility and reduces injury risk, it consistently ranks the lowest for muscle building compared to weight training, emphasizing its role as a supplementary activity.

Abstract

This study examines the role of stretching in muscle building and its implications for fitness enthusiasts. While stretching offers benefits in terms of flexibility and injury prevention, it falls short as a primary method for muscle growth. The focus of stretching on range of motion rather than muscle mass and strength limits its effectiveness. In isolation, stretching lacks the necessary resistance to stimulate muscle growth. Moreover, my analysis using R reveals that stretching ranks the lowest in terms of workout ratings. The findings highlight the importance of incorporating weight and resistance training as the primary approaches for muscle development.

Introduction

Stretching enhances flexibility and prevents injuries, but its effectiveness in building muscle mass and strength is debated. This study explores the role of stretching in muscle building compared to other exercises. Stretching prioritizes flexibility over muscle development due to inadequate resistance and tension. It may not yield significant gains in muscle mass or strength. Excessive stretching can even reduce muscle activation and power output. Analysis of workout ratings using R shows stretching ranks lowest for muscle building. Weight and resistance training are emphasized as primary methods, with stretching as a supplementary activity for flexibility.

General Setup

library(tidyverse)
library(tidytext)
library(ggtext)
library(RColorBrewer)
library(extrafont)
library(plotly)
library(htmlwidgets)
# font_import()
loadfonts()

Data Wrangling

gymDs <- read_csv("../../../assets/datasets/megaGymDataset.csv")

# head(gymDs, 5)
# names(gymDs)

ds <- gymDs %>%
    mutate(
        ID = ...1,
        Level = factor(Level, levels = c("Beginner", "Intermediate", "Expert")),
        Type = as.factor(Type)
    ) %>%
    select(-...1) %>%
    drop_na()

Unleashing the Power of Plotly

plotDs <- ds %>%
    group_by(Type, Level) %>%
    summarize(meanRating = mean(Rating)) %>%
    arrange(Type, meanRating) %>%
    ungroup()

p <- plotDs %>%
    highlight_key(., ~ reorder_within(Type, meanRating, Level)) %>%
    ggplot(aes(
        x = meanRating,
        y = reorder_within(Type, meanRating, Level),
        fill = fct_reorder(Type, meanRating),
        text = paste0(
            "Rating: ", round(meanRating, 2),
            "<br>Type: ", Type
        )
    )) +
    geom_col(color = "black") +
    facet_grid(
        rows = vars(Level),
        scales = "free_y",
        switch = "y",
        space = "free_y"
    ) +
    scale_y_reordered() +
    scale_fill_brewer(palette = "PuBuGn") +
    labs(
        title = "Ranking Exercise Type According to Experience Level of Individuals",
        x = "Average Rating of Each Exercise Type",
        fill = "Workout Types"
    ) +
    theme_minimal() +
    myTheme


ggplotly(p, tooltip = "text") %>%
    config(displayModeBar = FALSE) %>%
    highlight(on = "plotly_hover", off = "plotly_doubleclick") %>%
    layout(
        uniformtext = list(minsize = 8, mode = "hide"),
        margin = list(b = 70, l = 140, r = 140)
    )

Conclusion

While stretching remains valuable for improving flexibility and reducing the risk of injuries, it should be viewed as a supplementary activity rather than the main strategy for building muscle mass and strength. The incorporation of weight and resistance training, supported by the utilization of interactive plots using R, offers a more effective and comprehensive approach to achieving desired muscle development goals.

Data References

Chang, Winston. 2023. Extrafont: Tools for Using Fonts. https://github.com/wch/extrafont.
Grolemund, Garrett, and Hadley Wickham. 2011. “Dates and Times Made Easy with lubridate.” Journal of Statistical Software 40 (3): 1–25. https://www.jstatsoft.org/v40/i03/.
Müller, Kirill, and Hadley Wickham. 2023. Tibble: Simple Data Frames. https://tibble.tidyverse.org/.
Neuwirth, Erich. 2022. RColorBrewer: ColorBrewer Palettes. https://CRAN.R-project.org/package=RColorBrewer.
Robinson, David, and Julia Silge. 2024. Tidytext: Text Mining Using Dplyr, Ggplot2, and Other Tidy Tools. https://juliasilge.github.io/tidytext/.
Sievert, Carson. 2020. Interactive Web-Based Data Visualization with r, Plotly, and Shiny. Chapman; Hall/CRC. https://plotly-r.com.
Sievert, Carson, Chris Parmer, Toby Hocking, Scott Chamberlain, Karthik Ram, Marianne Corvellec, and Pedro Despouy. 2024. Plotly: Create Interactive Web Graphics via Plotly.js. https://plotly-r.com.
Silge, Julia, and David Robinson. 2016. “Tidytext: Text Mining and Analysis Using Tidy Data Principles in r.” JOSS 1 (3). https://doi.org/10.21105/joss.00037.
Spinu, Vitalie, Garrett Grolemund, and Hadley Wickham. 2024. Lubridate: Make Dealing with Dates a Little Easier. https://lubridate.tidyverse.org.
Vaidyanathan, Ramnath, Yihui Xie, JJ Allaire, Joe Cheng, Carson Sievert, and Kenton Russell. 2023. Htmlwidgets: HTML Widgets for r. https://github.com/ramnathv/htmlwidgets.
Wickham, Hadley. 2016. Ggplot2: Elegant Graphics for Data Analysis. Springer-Verlag New York. https://ggplot2.tidyverse.org.
———. 2023a. Forcats: Tools for Working with Categorical Variables (Factors). https://forcats.tidyverse.org/.
———. 2023b. Stringr: Simple, Consistent Wrappers for Common String Operations. https://stringr.tidyverse.org.
———. 2023c. Tidyverse: Easily Install and Load the Tidyverse. https://tidyverse.tidyverse.org.
Wickham, Hadley, Mara Averick, Jennifer Bryan, Winston Chang, Lucy D’Agostino McGowan, Romain François, Garrett Grolemund, et al. 2019. “Welcome to the tidyverse.” Journal of Open Source Software 4 (43): 1686. https://doi.org/10.21105/joss.01686.
Wickham, Hadley, Winston Chang, Lionel Henry, Thomas Lin Pedersen, Kohske Takahashi, Claus Wilke, Kara Woo, Hiroaki Yutani, Dewey Dunnington, and Teun van den Brand. 2024. Ggplot2: Create Elegant Data Visualisations Using the Grammar of Graphics. https://ggplot2.tidyverse.org.
Wickham, Hadley, Romain François, Lionel Henry, Kirill Müller, and Davis Vaughan. 2023. Dplyr: A Grammar of Data Manipulation. https://dplyr.tidyverse.org.
Wickham, Hadley, and Lionel Henry. 2025. Purrr: Functional Programming Tools. https://purrr.tidyverse.org/.
Wickham, Hadley, Jim Hester, and Jennifer Bryan. 2024. Readr: Read Rectangular Text Data. https://readr.tidyverse.org.
Wickham, Hadley, Davis Vaughan, and Maximilian Girlich. 2024. Tidyr: Tidy Messy Data. https://tidyr.tidyverse.org.
Wilke, Claus O., and Brenton M. Wiernik. 2022. Ggtext: Improved Text Rendering Support for Ggplot2. https://wilkelab.org/ggtext/.