Used libraries

library(tidyverse)
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ dplyr     1.1.3     ✔ readr     2.1.4
## ✔ forcats   1.0.0     ✔ stringr   1.5.0
## ✔ ggplot2   3.4.4     ✔ tibble    3.2.1
## ✔ lubridate 1.9.3     ✔ tidyr     1.3.0
## ✔ purrr     1.0.2     
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag()    masks stats::lag()
## ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
library(kableExtra)
## 
## Attaching package: 'kableExtra'
## 
## The following object is masked from 'package:dplyr':
## 
##     group_rows
library(reshape2)
## 
## Attaching package: 'reshape2'
## 
## The following object is masked from 'package:tidyr':
## 
##     smiths

Import cleaned data

df <- read.csv("fitness trends 2023 (cleaned).csv")

df %>% 
  kable() %>%
  kable_styling(bootstrap_options= c("striped", "hover")) %>%
  scroll_box(width="100%", height= "500px")
Year Rank_1 Rank_2 Rank_3 Rank_4 Rank_5 Rank_6 Rank_7 Rank_8 Rank_9 Rank_10
2007 Children and Obesity Fitness Programs for Older Adults Employing Certified Fitness Professionals Functional Fitness Training Core Training Strength Training Personal Training Mind/Body Exercise Exercise for Weight Loss Outcome Measurements
2008 Employing Certified Fitness Professionals Children and Obesity Personal Training Strength Training Core Training Fitness Programs for Older Adults Pilates Functional Fitness Training Stability Ball Yoga
2009 Employing Certified Fitness Professionals Children and Obesity Personal Training Strength Training Core Training Fitness Programs for Older Adults Pilates Stability Ball Sport-Specific Training Balance Training
2010 Employing Certified Fitness Professionals Strength Training Children and Obesity Personal Training Core Training Fitness Programs for Older Adults Functional Fitness Training Sport-Specific Training Pilates Group Training
2011 Employing Certified Fitness Professionals Fitness Programs for Older Adults Strength Training Children and Obesity Personal Training Core Training Exercise for Weight Loss Boot Camp Functional Fitness Training Physician Referrals
2012 Employing Certified Fitness Professionals Strength Training Fitness Programs for Older Adults Exercise for Weight Loss Children and Obesity Personal Training Core Training Group Training Zumba and Other Dance Workouts Functional Fitness Training
2013 Employing Certified Fitness Professionals Strength Training Body Weight Training Children and Obesity Exercise for Weight Loss Fitness Programs for Older Adults Personal Training Functional Fitness Training Core Training Group Training
2014 High Intensity Interval Training (Hiit) Body Weight Training Employing Certified Fitness Professionals Strength Training Exercise for Weight Loss Personal Training Fitness Programs for Older Adults Functional Fitness Training Group Training Yoga
2015 Body Weight Training High Intensity Interval Training (Hiit) Employing Certified Fitness Professionals Strength Training Personal Training Exercise for Weight Loss Yoga Fitness Programs for Older Adults Functional Fitness Training Group Training
2016 Wearable Technology Body Weight Training High Intensity Interval Training (Hiit) Strength Training Employing Certified Fitness Professionals Personal Training Functional Fitness Training Fitness Programs for Older Adults Exercise for Weight Loss Yoga
2017 Wearable Technology Body Weight Training High Intensity Interval Training (Hiit) Employing Certified Fitness Professionals Strength Training Group Training Exercise is Medicine Yoga Personal Training Exercise for Weight Loss
2018 High Intensity Interval Training (Hiit) Group Training Wearable Technology Body Weight Training Strength Training Employing Certified Fitness Professionals Yoga Personal Training Fitness Programs for Older Adults Functional Fitness Training
2019 Wearable Technology Group Training High Intensity Interval Training (Hiit) Fitness Programs for Older Adults Body Weight Training Employing Certified Fitness Professionals Yoga Personal Training Functional Fitness Training Exercise is Medicine
2020 Wearable Technology High Intensity Interval Training (Hiit) Group Training Strength Training with Free Weights Personal Training Exercise is Medicine Body Weight Training Fitness Programs for Older Adults Health/Wellness Coaching Employing Certified Fitness Professionals
2021 Online Live and on-Demand Exercise Classes Wearable Technology Body Weight Training Outdoor Activities High Intensity Interval Training (Hiit) Virtual Training Exercise is Medicine Strength Training with Free Weights Fitness Programs for Older Adults Personal Training
2022 Wearable Technology Home Exercise Gyms Outdoor Activities Strength Training with Free Weights Exercise for Weight Loss Personal Training High Intensity Interval Training (Hiit) Body Weight Training Online Live and on-Demand Exercise Classes Health/Wellness Coaching
2023 Wearable Technology Strength Training with Free Weights Body Weight Training Fitness Programs for Older Adults Functional Fitness Training Outdoor Activities High Intensity Interval Training (Hiit) Exercise for Weight Loss Employing Certified Fitness Professionals Personal Training

Transform data

Initiate a dataframe with default value 0 for all types of training

Years as Columns

types_all <- as.list(df[, 2:ncol(df)])
types_uni <- sort(unique(unlist(types_all, recursive=FALSE)))

Types <- c(types_uni)
new_trends <- data.frame(Types)

new_trends[c(1:18)] <- 0
new_trends[, 1] <- Types

colnames(new_trends)[2:ncol(new_trends)]<- c(2007:2023)

new_trends %>%
  kable() %>%
  kable_styling(bootstrap_options=c("striped", "hover")) %>%
  scroll_box(width="100%", height="300px")
Types 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023
Balance Training 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Body Weight Training 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Boot Camp 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Children and Obesity 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Core Training 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Employing Certified Fitness Professionals 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Exercise for Weight Loss 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Exercise is Medicine 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Fitness Programs for Older Adults 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Functional Fitness Training 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Group Training 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Health/Wellness Coaching 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
High Intensity Interval Training (Hiit) 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Home Exercise Gyms 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Mind/Body Exercise 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Online Live and on-Demand Exercise Classes 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Outcome Measurements 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Outdoor Activities 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Personal Training 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Physician Referrals 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Pilates 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Sport-Specific Training 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Stability Ball 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Strength Training 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Strength Training with Free Weights 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Virtual Training 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Wearable Technology 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Yoga 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Zumba and Other Dance Workouts 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

Convert ranking to popularity in a time series

for(Type in Types){
  #print(Type)
  
  for(year in 2007:2023){
    for(rank in colnames(df)[2:ncol(df)]){
      matches <- df[(df[rank]==Type) & (df['Year']==year), ]
      
      if(nrow(matches)>0){
        #print(matches)
        
        index <- which(matches==Type, arr.ind=FALSE)
        #print(index)
        
        popularity <- 12-index
        #print(popularity)
        
        new_trends[new_trends['Types']==Type, as.character(year)] <- popularity
      }
    }
  }
}
  
new_trends %>%
  kable() %>% 
  kable_styling(bootstrap_options=c("striped", "hover", "responsive")) %>% 
  scroll_box(height="300px")
Types 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023
Balance Training 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Body Weight Training 0 0 0 0 0 0 8 9 10 9 9 7 6 4 8 3 8
Boot Camp 0 0 0 0 3 0 0 0 0 0 0 0 0 0 0 0 0
Children and Obesity 10 9 9 8 7 6 7 0 0 0 0 0 0 0 0 0 0
Core Training 6 6 6 6 5 4 2 0 0 0 0 0 0 0 0 0 0
Employing Certified Fitness Professionals 8 10 10 10 10 10 10 8 8 6 7 5 5 1 0 0 2
Exercise for Weight Loss 2 0 0 0 4 7 6 6 5 2 1 0 0 0 0 6 3
Exercise is Medicine 0 0 0 0 0 0 0 0 0 0 4 0 1 5 4 0 0
Fitness Programs for Older Adults 9 5 5 5 9 8 5 4 3 3 0 2 7 3 2 0 7
Functional Fitness Training 7 3 0 4 2 1 3 3 2 4 0 1 2 0 0 0 6
Group Training 0 0 0 1 0 3 1 2 1 0 5 9 9 8 0 0 0
Health/Wellness Coaching 0 0 0 0 0 0 0 0 0 0 0 0 0 2 0 1 0
High Intensity Interval Training (Hiit) 0 0 0 0 0 0 0 10 9 8 8 10 8 9 6 4 4
Home Exercise Gyms 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 9 0
Mind/Body Exercise 3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Online Live and on-Demand Exercise Classes 0 0 0 0 0 0 0 0 0 0 0 0 0 0 10 2 0
Outcome Measurements 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Outdoor Activities 0 0 0 0 0 0 0 0 0 0 0 0 0 0 7 8 5
Personal Training 4 8 8 7 6 5 4 5 6 5 2 3 3 6 1 5 1
Physician Referrals 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0
Pilates 0 4 4 2 0 0 0 0 0 0 0 0 0 0 0 0 0
Sport-Specific Training 0 0 2 3 0 0 0 0 0 0 0 0 0 0 0 0 0
Stability Ball 0 2 3 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Strength Training 5 7 7 9 8 9 9 7 7 7 6 6 0 0 0 0 0
Strength Training with Free Weights 0 0 0 0 0 0 0 0 0 0 0 0 0 7 3 7 9
Virtual Training 0 0 0 0 0 0 0 0 0 0 0 0 0 0 5 0 0
Wearable Technology 0 0 0 0 0 0 0 0 0 10 10 8 10 10 9 10 10
Yoga 0 1 0 0 0 0 0 1 4 1 3 4 4 0 0 0 0
Zumba and Other Dance Workouts 0 0 0 0 0 2 0 0 0 0 0 0 0 0 0 0 0

Save as a .csv

write_csv(new_trends, "fitness trends 2023 (transformed_year).csv")

Read from a .csv

trends_con <- read.csv("fitness trends 2023 (transformed_year).csv", check.names=FALSE)

trends_con %>% 
  kable() %>% 
  kable_styling(bootstrap_options=c("striped", "hover", "responsive")) %>% 
  scroll_box(height="300px")
Types 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023
Balance Training 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Body Weight Training 0 0 0 0 0 0 8 9 10 9 9 7 6 4 8 3 8
Boot Camp 0 0 0 0 3 0 0 0 0 0 0 0 0 0 0 0 0
Children and Obesity 10 9 9 8 7 6 7 0 0 0 0 0 0 0 0 0 0
Core Training 6 6 6 6 5 4 2 0 0 0 0 0 0 0 0 0 0
Employing Certified Fitness Professionals 8 10 10 10 10 10 10 8 8 6 7 5 5 1 0 0 2
Exercise for Weight Loss 2 0 0 0 4 7 6 6 5 2 1 0 0 0 0 6 3
Exercise is Medicine 0 0 0 0 0 0 0 0 0 0 4 0 1 5 4 0 0
Fitness Programs for Older Adults 9 5 5 5 9 8 5 4 3 3 0 2 7 3 2 0 7
Functional Fitness Training 7 3 0 4 2 1 3 3 2 4 0 1 2 0 0 0 6
Group Training 0 0 0 1 0 3 1 2 1 0 5 9 9 8 0 0 0
Health/Wellness Coaching 0 0 0 0 0 0 0 0 0 0 0 0 0 2 0 1 0
High Intensity Interval Training (Hiit) 0 0 0 0 0 0 0 10 9 8 8 10 8 9 6 4 4
Home Exercise Gyms 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 9 0
Mind/Body Exercise 3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Online Live and on-Demand Exercise Classes 0 0 0 0 0 0 0 0 0 0 0 0 0 0 10 2 0
Outcome Measurements 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Outdoor Activities 0 0 0 0 0 0 0 0 0 0 0 0 0 0 7 8 5
Personal Training 4 8 8 7 6 5 4 5 6 5 2 3 3 6 1 5 1
Physician Referrals 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0
Pilates 0 4 4 2 0 0 0 0 0 0 0 0 0 0 0 0 0
Sport-Specific Training 0 0 2 3 0 0 0 0 0 0 0 0 0 0 0 0 0
Stability Ball 0 2 3 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Strength Training 5 7 7 9 8 9 9 7 7 7 6 6 0 0 0 0 0
Strength Training with Free Weights 0 0 0 0 0 0 0 0 0 0 0 0 0 7 3 7 9
Virtual Training 0 0 0 0 0 0 0 0 0 0 0 0 0 0 5 0 0
Wearable Technology 0 0 0 0 0 0 0 0 0 10 10 8 10 10 9 10 10
Yoga 0 1 0 0 0 0 0 1 4 1 3 4 4 0 0 0 0
Zumba and Other Dance Workouts 0 0 0 0 0 2 0 0 0 0 0 0 0 0 0 0 0

Filter interesting data points

Find popularity of all types of training for recent 5 years

cols <- c("Types", as.character(c(2019:2023)))

trends_con_recent <- trends_con[, cols]

trends_con_recent %>% 
  kable() %>% 
  kable_styling(bootstrap_options=c("striped", "hover")) %>% 
  scroll_box(width="100%", height="300px")
Types 2019 2020 2021 2022 2023
Balance Training 0 0 0 0 0
Body Weight Training 6 4 8 3 8
Boot Camp 0 0 0 0 0
Children and Obesity 0 0 0 0 0
Core Training 0 0 0 0 0
Employing Certified Fitness Professionals 5 1 0 0 2
Exercise for Weight Loss 0 0 0 6 3
Exercise is Medicine 1 5 4 0 0
Fitness Programs for Older Adults 7 3 2 0 7
Functional Fitness Training 2 0 0 0 6
Group Training 9 8 0 0 0
Health/Wellness Coaching 0 2 0 1 0
High Intensity Interval Training (Hiit) 8 9 6 4 4
Home Exercise Gyms 0 0 0 9 0
Mind/Body Exercise 0 0 0 0 0
Online Live and on-Demand Exercise Classes 0 0 10 2 0
Outcome Measurements 0 0 0 0 0
Outdoor Activities 0 0 7 8 5
Personal Training 3 6 1 5 1
Physician Referrals 0 0 0 0 0
Pilates 0 0 0 0 0
Sport-Specific Training 0 0 0 0 0
Stability Ball 0 0 0 0 0
Strength Training 0 0 0 0 0
Strength Training with Free Weights 0 7 3 7 9
Virtual Training 0 0 5 0 0
Wearable Technology 10 10 9 10 10
Yoga 4 0 0 0 0
Zumba and Other Dance Workouts 0 0 0 0 0

Types of training with a total popularity for recent 5 years > 15, and in 2023 > 4

trends_con_recent_top <- trends_con_recent[
  rowSums(trends_con_recent[, 2:ncol(trends_con_recent)], na.rm=TRUE)>15 & 
  (trends_con_recent['2023']>4), ]

trends_con_recent_top %>% 
  kable() %>% 
  kable_styling(bootstrap_options=c("striped", "hover")) %>% 
  scroll_box(width="100%")
Types 2019 2020 2021 2022 2023
2 Body Weight Training 6 4 8 3 8
9 Fitness Programs for Older Adults 7 3 2 0 7
18 Outdoor Activities 0 0 7 8 5
25 Strength Training with Free Weights 0 7 3 7 9
27 Wearable Technology 10 10 9 10 10

Melt data and convert data type as needed for time series graph

data_final <- melt(trends_con_recent_top, id.vars='Types')
data_final$Types <- as.factor(data_final$Types)
data_final$variable <- as.integer(as.character(data_final$variable))

data_final %>% 
  kable() %>% 
  kable_styling(bootstrap_options=c("striped", "hover")) %>% 
  scroll_box(width="100%", height="300px")
Types variable value
Body Weight Training 2019 6
Fitness Programs for Older Adults 2019 7
Outdoor Activities 2019 0
Strength Training with Free Weights 2019 0
Wearable Technology 2019 10
Body Weight Training 2020 4
Fitness Programs for Older Adults 2020 3
Outdoor Activities 2020 0
Strength Training with Free Weights 2020 7
Wearable Technology 2020 10
Body Weight Training 2021 8
Fitness Programs for Older Adults 2021 2
Outdoor Activities 2021 7
Strength Training with Free Weights 2021 3
Wearable Technology 2021 9
Body Weight Training 2022 3
Fitness Programs for Older Adults 2022 0
Outdoor Activities 2022 8
Strength Training with Free Weights 2022 7
Wearable Technology 2022 10
Body Weight Training 2023 8
Fitness Programs for Older Adults 2023 7
Outdoor Activities 2023 5
Strength Training with Free Weights 2023 9
Wearable Technology 2023 10

Draw plots

ggplot(data_final, aes(x=variable, y=value, col=Types))+
  geom_line()+
  scale_x_continuous(breaks=pretty(data_final$variable, n=4))+
  scale_y_continuous(breaks=pretty(data_final$value, n=5))+
  
  labs(x="Year", y="Popularity")+
  ggtitle("Years as Columns")+
  theme(plot.title=element_text(hjust=0.5))

---

References:

(Thompson 2023)

Thompson, Walter R. 2023. “Worldwide Survey of Fitness Trends for 2023.” ACSM’S Health & Fitness Journal 27 (1): 9–18. https://doi.org/10.1249/fit.0000000000000834.