library(readxl)
library(dplyr)
##
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
library(ggplot2)
library(lubridate)
##
## Attaching package: 'lubridate'
## The following objects are masked from 'package:base':
##
## date, intersect, setdiff, union
data <- read.csv("C:/Users/nika/Downloads/Daily Activity Data 2025(Data).csv")
data$SessionDate <- as.Date(data$`Session.Date`, format = "%m/%d/%Y")
data$WeekStart <- floor_date(data$SessionDate, "week")
play_sessions <- data %>%
filter(grepl("play", `Session.Type`, ignore.case = TRUE)) %>%
group_by(WeekStart) %>%
summarise(Count = n()) %>%
arrange(WeekStart) %>%
mutate(WeekNumber = row_number())
ggplot(play_sessions, aes(x = WeekNumber, y = Count)) +
geom_line(color = "steelblue", size = 1.2) +
geom_point(color = "steelblue", size = 3) +
labs(
title = "Play Sessions Week Over Week",
x = "Week",
y = "Number of Play Sessions"
) +
theme_minimal() +
theme(
plot.title = element_text(hjust = 0.5, size = 16, face = "bold")
) +
scale_x_continuous(breaks = play_sessions$WeekNumber)
## Warning: Using `size` aesthetic for lines was deprecated in ggplot2 3.4.0.
## ℹ Please use `linewidth` instead.
## This warning is displayed once every 8 hours.
## Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
## generated.

lesson_totals <- data %>%
filter(grepl("lesson", `Session.Type`, ignore.case = TRUE)) %>%
filter(Coach %in% c("Valerii Fedoruk", "Chad Smith", "Ronny Vlassaks*", "Pascal Lienard*", "Dina Rosli", "Sam Goodman")) %>%
group_by(Coach) %>%
summarise(Total = n()) %>%
arrange(desc(Total))
lessons_weekly <- data %>%
filter(grepl("lesson", `Session.Type`, ignore.case = TRUE)) %>%
filter(Coach %in% c("Valerii Fedoruk", "Chad Smith", "Ronny Vlassaks*", "Pascal Lienard*", "Dina Rosli", "Sam Goodman")) %>%
group_by(WeekStart, Coach) %>%
summarise(Count = n(), .groups = 'drop') %>%
arrange(WeekStart) %>%
group_by(Coach) %>%
mutate(WeekNumber = dense_rank(WeekStart))
ggplot(lesson_totals, aes(x = reorder(Coach, Total), y = Total)) +
geom_bar(stat = "identity", fill = "steelblue") +
coord_flip() +
labs(
title = "Total Lessons by Coach",
x = "Coach",
y = "Total Number of Lessons"
) +
theme_minimal()

geom_text(aes(label = Total), hjust = -0.3, size = 3.5)
## mapping: label = ~Total
## geom_text: na.rm = FALSE, parse = FALSE, check_overlap = FALSE, size.unit = mm
## stat_identity: na.rm = FALSE
## position_nudge
ggplot(lessons_weekly, aes(x = WeekNumber, y = Count, color = Coach, group = Coach)) +
geom_line(size = 1.2) +
geom_point(size = 3) +
labs(
title = "Lessons by Coach Week Over Week",
x = "Week",
y = "Number of Lessons",
color = "Coach"
) +
theme_minimal()

scale_x_continuous(breaks = unique(lessons_weekly$WeekNumber.y))
## Warning: Unknown or uninitialised column: `WeekNumber.y`.
## <ScaleContinuousPosition>
## Range:
## Limits: 0 -- 1
ggplot(lessons_weekly, aes(x = WeekNumber, y = Count)) +
geom_line(color = "steelblue", size = 1.2) +
geom_point(color = "steelblue", size = 3) +
facet_wrap(~ Coach, ncol = 2) +
labs(
title = "Play Sessions Week Over Week by Coach",
x = "Week",
y = "Number of Play Sessions"
) +
theme_minimal()

scale_x_continuous(breaks = unique(play_sessions$WeekNumber))
## <ScaleContinuousPosition>
## Range:
## Limits: 0 -- 1
non_play_sessions <- data %>%
filter(!grepl("play", `Session.Type`, ignore.case = TRUE)) %>%
group_by(WeekStart, `Session.Type`) %>%
summarise(Count = n(), .groups = 'drop') %>%
arrange(WeekStart) %>%
group_by(`Session.Type`) %>%
mutate(WeekNumber = row_number()) %>%
ungroup()
ggplot(non_play_sessions, aes(x = reorder(`Session.Type`, Count), y = Count)) +
geom_bar(stat = "identity", fill = "coral") +
coord_flip() +
labs(
title = "Non-Play Sessions Ordered by Popularity",
x = "Session Type",
y = "Number of Sessions"
) +
theme_minimal()

geom_text(aes(label = Count), hjust = -0.3, size = 3.5)
## mapping: label = ~Count
## geom_text: na.rm = FALSE, parse = FALSE, check_overlap = FALSE, size.unit = mm
## stat_identity: na.rm = FALSE
## position_nudge
ggplot(non_play_sessions, aes(x = WeekNumber, y = Count, color = `Session.Type`, group = `Session.Type`)) +
geom_line(size = 1.2) +
geom_point(size = 3) +
labs(
title = "Non-Play Sessions Week Over Week by Type",
x = "Week",
y = "Number of Sessions",
color = "Session Type"
) +
theme_minimal()

scale_x_continuous(breaks = unique(non_play_sessions$WeekNumber))
## <ScaleContinuousPosition>
## Range:
## Limits: 0 -- 1
ggplot(non_play_sessions, aes(x = WeekNumber, y = Count)) +
geom_line(color = "steelblue", size = 1.2) +
geom_point(color = "steelblue", size = 3) +
facet_wrap(~ `Session.Type`, ncol = 2) +
labs(
title = "Non-Play Sessions over Weeks by Type",
x = "Week",
y = "Number of Sessions"
) +
theme_minimal()

scale_x_continuous(breaks = unique(non_play_sessions$WeekNumber))
## <ScaleContinuousPosition>
## Range:
## Limits: 0 -- 1