This dashboard applies the Quantified Self (QS) framework to analyze my PCOS and weight loss journey.
Objectives - Understand how sleep, activity, and
nutrition influence daily energy and consistency
- Identify patterns affecting mood, cravings, and productivity
- Explore relationships between lifestyle behaviors and overall
well-being
Personal Journey
My PCOS and weight loss journey has been shaped by fluctuations in energy, cravings, mood, and consistency rather than just changes in weight.
By tracking these daily experiences as data over time, this project moves beyond assumptions and highlights which habits support progress and which disrupt it.
This approach allows me to better understand how lifestyle patterns influence my overall well-being and long-term consistency.
Data Collection
This project follows the Quantified Self approach by tracking personal
lifestyle data over a 30-day period, including sleep, physical activity,
mood, and nutrition. Data was manually logged and supplemented with
wearable tracking to ensure consistency.
Data Analysis
Data analysis was performed using R, with packages such as ggplot2 and
dplyr to identify patterns, trends, and relationships between
variables.
Data Visualization
The dashboard was developed using flexdashboard, with line charts,
scatter plots, histograms, and box plots to represent trends,
distributions, and correlations.
Visualization choices were guided by principles from Tufte (2001) and Schwabish (2021), emphasizing clarity, simplicity, and meaningful interpretation.
This dashboard is structured around the following key analytical questions:
How does sleep duration affect my energy levels and cravings?
Do higher step counts and workout minutes improve my mood and productivity?
How does protein intake influence hunger levels and snacking behavior?
Are carb-dense meals associated with afternoon energy crashes?
How do PCOS symptoms and cycle-related changes affect my daily habits and overall weight-loss consistency?
This section examines the relationship between sleep duration, and cravings, highlighting how sleep patterns may impact daily performance and appetite.
↓ Lower sleep durations are associated with higher craving levels, indicating reduced appetite control.
↑ As sleep duration increases (7+ hours), cravings decrease and stabilize.
↻ More consistent sleep patterns align with improved daily outcomes.
✔ Sleep is a key behavioral driver influencing energy balance and dietary control.
This section examines whether higher physical activity levels, measured through steps and workout minutes, are associated with improved mood and productivity
↑ Higher step counts are associated with improved productivity scores, suggesting a positive relationship between physical activity and daily performance.
↗ Mood scores tend to increase as activity levels move from low to moderate and high, indicating that more active days align with better emotional well-being.
↓ Low activity days cluster around lower mood and productivity levels, showing that reduced movement may negatively affect both performance and emotional state.
✔ Overall, these findings suggest that physical activity is an important behavioral factor supporting both mood regulation and productivity in a consistent wellness routine.
This section examines whether higher protein intake is associated with lower hunger levels and reduced snacking behavior. Protein plays an important role in satiety and appetite control, which are especially relevant in a weight-loss journey and in managing eating patterns affected by PCOS.
The visualizations show a strong inverse relationship between protein intake and hunger levels. The scatter plot indicates that lower protein intake is consistently associated with higher hunger scores, while higher protein intake corresponds with lower and more stable hunger levels. This suggests that increasing protein intake may significantly improve satiety throughout the day.
The category-based comparison further reinforces this pattern. Low-protein days are clustered around higher hunger levels, while moderate-protein days show a noticeable reduction in hunger. High-protein days are associated with the lowest hunger levels and the least variability, indicating more consistent appetite control.
Overall, these findings highlight protein as a key nutritional factor in regulating hunger and reducing snacking behavior. For a weight-loss and PCOS management journey, maintaining adequate protein intake may support better appetite control, improve dietary consistency, and reduce the likelihood of overeating.
This section examines whether carb-dense meals are associated with afternoon energy crashes. For weight management and PCOS, meal composition can affect energy stability, cravings, and overall consistency throughout the day.
The results show that carb-dense meals are associated with a higher likelihood of afternoon crashes. Crash events frequently occur on days with carb-heavy meals, while non-carb days are mostly linked with stable energy.
Cravings also tend to be higher on carb-dense meal days, suggesting a connection between energy crashes and increased appetite.
Overall, these findings indicate that carb-heavy meals may contribute to energy instability and stronger cravings, which can affect consistency in a weight-loss and PCOS management routine.
Cycle-related changes affect mood, energy, cravings, and overall consistency. Mood and energy are higher during the follicular and ovulatory phases, while they decline in the late luteal phase.
Cravings increase in the later phases, especially in the late luteal phase, where consistency is also lowest. In contrast, the ovulatory phase shows the highest consistency along with stronger mood and energy.
Overall, these patterns suggest that cycle-related fluctuations can impact daily habits and weight-loss consistency, with some phases being more supportive than others.
This dashboard applied a Quantified Self approach to understand how sleep, activity, nutrition, carb-dense meals, and cycle-related changes influence my PCOS and weight-loss journey. The correlation heatmap provides an integrated view of how these factors interact rather than acting independently.
The heatmap reinforces several key patterns observed throughout the dashboard. Sleep shows a positive relationship with energy and mood, while lower sleep is associated with higher cravings. Physical activity is positively linked with mood and productivity, supporting the role of movement in improving both mental and functional well-being.
Nutritional patterns are also clearly reflected. Protein intake shows a negative relationship with hunger and cravings, while carb-dense meals align with higher cravings and energy instability. These patterns support the earlier findings that meal composition plays an important role in appetite regulation and consistency.
Cycle-related variables show associations with mood, energy, and cravings, indicating that hormonal fluctuations may influence daily habits and weight-loss consistency. Phases with lower energy and higher cravings appear to align with reduced consistency.
Overall, the heatmap highlights that my weight-loss and PCOS journey is influenced by a network of interconnected factors. Rather than a single habit driving outcomes, it is the combination of sleep, activity, nutrition, and cycle-related changes that shapes consistency and progress. This reinforces the importance of taking a holistic and adaptive approach to managing both health and routine.
Business Review Live. (n.d.). 8 out of 10 women revealed that PCOS had affected their self-esteem and body image [Image]. https://businessreviewlive.com/8-out-of-10-women-revealed-that-pcos-had-affected-their-self-esteem-and-body-image-2/
Quantified Self. (n.d.). Quantified Self. http://quantifiedself.com/
Tufte, E. R. (2001). The visual display of quantitative information (2nd ed.). Graphics Press.
Wexler, S., Shaffer, J., & Cotgreave, A. (2017). The big book of dashboards. Wiley.
R Core Team. (2023). R: A language and environment for statistical computing. https://www.r-project.org/
Iannone, R., Allaire, J., & Borges, B. (2020). flexdashboard: R Markdown format for flexible dashboards. https://rmarkdown.rstudio.com/flexdashboard/
Wickham, H. (2016). ggplot2: Elegant graphics for data analysis. Springer.
Teede, H. J., et al. (2018). International evidence-based guideline for the assessment and management of polycystic ovary syndrome. Human Reproduction.
Leidy, H. J., et al. (2015). The role of protein in weight loss and maintenance. American Journal of Clinical Nutrition.
---
title: "Final Project"
author: "Lipi Thakker"
date: "2026-04-19"
output:
flexdashboard::flex_dashboard:
orientation: rows
vertical_layout: fill
theme:
version: 5
bootswatch: flatly
source_code: embed
---
<style>
.section.level1 {
padding-top: 10px !important;
}
body {
padding-top: 100px !important;
}
.dashboard-row {
margin-top: 8px !important;
}
.navbar {
min-height: 90px !important;
}
.navbar-nav > li > a {
font-size: 14px !important;
}
h2 {
font-size: 26px !important;
font-weight: 600;
}
h3 {
font-size: 18px !important;
font-weight: 600;
}
/* KPI box container */
.value-box {
height: 120px !important;
border-radius: 10px;
padding: 10px;
}
/* KPI number */
.value-box .value {
font-size: 30px !important;
font-weight: bold;
}
/* KPI label */
.value-box .caption {
font-size: 16px !important;
opacity: 0.9;
}
</style>
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = FALSE, warning = FALSE, message = FALSE)
library(flexdashboard)
library(tidyverse)
library(plotly)
library(scales)
library(lubridate)
library(DT)
library(janitor)
library(htmltools)
library(janitor)
library(readxl)
library(shiny)
library(ggplot2)
```
```{r, include=FALSE}
library(ggplot2)
library(dplyr)
library(plotly)
# Custom dashboard theme
dashboard_theme <- theme_minimal(base_size = 12) +
theme(
plot.background = element_rect(fill = "#FFFFFF", color = "#E5EAF2", linewidth = 0.8),
panel.background = element_rect(fill = "#FFFFFF", color = NA),
panel.grid.major.y = element_line(color = "#EEF2F7", linewidth = 0.3),
panel.grid.major.x = element_blank(),
panel.grid.minor = element_blank(),
axis.title = element_text(size = 11, face = "bold", color = "#2F3A4A"),
axis.text = element_text(size = 10, color = "#374151"),
plot.title = element_text(size = 14, face = "bold", color = "#1F2937"),
plot.subtitle = element_text(size = 10.5, color = "#6B7280"),
legend.background = element_rect(fill = "#FFFFFF", color = NA),
plot.margin = margin(12, 12, 12, 12)
)
```
```{r}
qs <- read_excel("pcos_qs_30days.xlsx")
```
```{r data wrangling}
library(dplyr)
library(lubridate)
# Clean and transform
qs <- qs %>%
mutate(
date = as.Date(date),
day = factor(day, levels = c("Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun")),
weekend = ifelse(day %in% c("Sat", "Sun"), "Weekend", "Weekday"),
weekend = factor(weekend, levels = c("Weekday", "Weekend")),
snacking = factor(snacking, levels = c("No", "Yes")),
carb_dense_meal = factor(carb_dense_meal, levels = c("No", "Yes")),
afternoon_crash = factor(afternoon_crash, levels = c("No", "Yes")),
cycle_phase = factor(
cycle_phase,
levels = c("Menstrual", "Follicular", "Ovulatory", "Early Luteal", "Mid Luteal", "Late Luteal")
),
sleep_category = case_when(
sleep_hours < 6.5 ~ "Low Sleep",
sleep_hours >= 6.5 & sleep_hours <= 7.5 ~ "Adequate Sleep",
sleep_hours > 7.5 ~ "High Sleep"
),
sleep_category = factor(
sleep_category,
levels = c("Low Sleep", "Adequate Sleep", "High Sleep")
),
activity_level = case_when(
steps < 5000 ~ "Low Activity",
steps >= 5000 & steps < 9000 ~ "Moderate Activity",
steps >= 9000 ~ "High Activity"
),
activity_level = factor(
activity_level,
levels = c("Low Activity", "Moderate Activity", "High Activity")
),
protein_category = case_when(
protein_g < 70 ~ "Low Protein",
protein_g >= 70 & protein_g < 90 ~ "Moderate Protein",
protein_g >= 90 ~ "High Protein"
),
protein_category = factor(
protein_category,
levels = c("Low Protein", "Moderate Protein", "High Protein")
),
workout_day = ifelse(workout_minutes > 0, "Yes", "No"),
workout_day = factor(workout_day, levels = c("No", "Yes")),
good_day = ifelse(productivity_score >= 4 & mood_score >= 4, "Yes", "No"),
good_day = factor(good_day, levels = c("No", "Yes")),
weight_change = weight_lb - lag(weight_lb)
)
# Dashboard metrics
avg_sleep <- round(mean(qs$sleep_hours, na.rm = TRUE), 1)
avg_steps <- round(mean(qs$steps, na.rm = TRUE), 0)
avg_productivity <- mean(qs$productivity_score, na.rm = TRUE)
avg_mood <- round(mean(qs$mood_score, na.rm = TRUE), 1)
avg_protein <- round(mean(qs$protein_g, na.rm = TRUE), 0)
good_day_pct <- round(mean(qs$good_day == "Yes", na.rm = TRUE) * 100, 1)
avg_energy <- round(mean(qs$next_day_energy, na.rm = TRUE), 1)
avg_cravings <- round(mean(qs$cravings_level, na.rm = TRUE), 1)
avg_workout <- round(mean(qs$workout_minutes, na.rm = TRUE), 0)
avg_hunger <- round(mean(qs$hunger_level, na.rm = TRUE), 1)
snack_pct <- round(mean(qs$snacking == "Yes", na.rm = TRUE) * 100, 1)
carb_dense_pct <- round(mean(qs$carb_dense_meal == "Yes", na.rm = TRUE) * 100, 1)
crash_pct <- round(mean(qs$afternoon_crash == "Yes", na.rm = TRUE) * 100, 1)
most_common_phase <- names(sort(table(qs$cycle_phase), decreasing = TRUE))[1]
# Correlation data
num_data <- qs %>%
select(
sleep_hours,
next_day_energy,
cravings_level,
steps,
workout_minutes,
mood_score,
productivity_score,
protein_g,
hunger_level,
pcos_symptom_score,
habit_consistency,
weight_lb
)
corr_matrix <- cor(num_data, use = "complete.obs")
```
Introduction {data-icon="fa-info-circle"}
=======================================================================
Row {data-height=350}
-----------------------------------------------------------------------
```{r}
knitr::include_graphics("lets get better.png")
```
### 🎯 Project Outline {data-icon="fa-bullseye"}
This dashboard applies the Quantified Self (QS) framework to analyze my PCOS and weight loss journey.
**Objectives**
- Understand how sleep, activity, and nutrition influence daily energy and consistency
- Identify patterns affecting mood, cravings, and productivity
- Explore relationships between lifestyle behaviors and overall well-being
**Personal Journey**
My PCOS and weight loss journey has been shaped by fluctuations in energy, cravings, mood, and consistency rather than just changes in weight.
By tracking these daily experiences as data over time, this project moves beyond assumptions and highlights which habits support progress and which disrupt it.
This approach allows me to better understand how lifestyle patterns influence my overall well-being and long-term consistency.
### 📊 Methods Summary {data-icon="fa-cogs"}
**Data Collection**
This project follows the Quantified Self approach by tracking personal lifestyle data over a 30-day period, including sleep, physical activity, mood, and nutrition. Data was manually logged and supplemented with wearable tracking to ensure consistency.
**Data Analysis**
Data analysis was performed using R, with packages such as ggplot2 and dplyr to identify patterns, trends, and relationships between variables.
**Data Visualization**
The dashboard was developed using flexdashboard, with line charts, scatter plots, histograms, and box plots to represent trends, distributions, and correlations.
Visualization choices were guided by principles from Tufte (2001) and Schwabish (2021), emphasizing clarity, simplicity, and meaningful interpretation.
### ❓ Research Questions
This dashboard is structured around the following key analytical questions:
1. How does sleep duration affect my energy levels and cravings?
2. Do higher step counts and workout minutes improve my mood and productivity?
3. How does protein intake influence hunger levels and snacking behavior?
4. Are carb-dense meals associated with afternoon energy crashes?
5. How do PCOS symptoms and cycle-related changes affect my daily habits and overall weight-loss consistency?
Row
-----------------------------------------------------------------------
<div style="text-align:center; font-size:14px; font-style:italic; margin-top:8px;"> Figure 1. Image illustrating the impact of PCOS on self-esteem and lifestyle (Business Review Live, n.d.). </div>
😴 Sleep, Energy & Cravings
=======================================================================
### Research Question: How does sleep duration affect my energy levels and cravings?
This section examines the relationship between sleep duration, and cravings, highlighting how sleep patterns may impact daily performance and appetite.
Row {data-height=350}
-----------------------------------------------------------------------
### Sleep Duration vs Cravings Relationship
```{r echo=FALSE, message=FALSE, warning=FALSE, fig.width=8, fig.height=4.2, out.width='100%'}
p_sleep_cravings <- ggplot(qs, aes(
x = sleep_hours,
y = cravings_level,
text = paste(
"Date:", date,
"<br>Sleep Hours:", sleep_hours,
"<br>Cravings:", cravings_level,
"<br>Energy:", next_day_energy,
"<br>Sleep Category:", sleep_category
)
)) +
geom_point(
aes(color = sleep_category),
size = 3.2,
alpha = 0.9) +
geom_smooth(
aes(group = 1),
method = "lm",
se = FALSE,
linewidth = 1.1,
color = "#9CA3AF"
) +
scale_color_manual(
values = c(
"Low Sleep" = "#D32F2F",
"Adequate Sleep" = "#1976D2",
"High Sleep" = "#388E3C"
)
) +
labs(
subtitle = "Lower sleep is associated with higher cravings",
x = "Sleep Hours",
y = "Cravings Level",
color = "Sleep Category"
) +
theme_minimal() +
theme(
panel.background = element_rect(fill = "#F7F9FC", color = NA),
plot.background = element_rect(fill = "#F7F9FC", color = NA),
panel.grid.major = element_line(color = "#E3E8EF"),
panel.grid.minor = element_blank(),
plot.title = element_text(face = "bold", size = 14),
axis.title = element_text(size = 11),
axis.text = element_text(color = "#333333")
) +
dashboard_theme
ggplotly(p_sleep_cravings, tooltip = "text") %>%
layout(
height = 260,
paper_bgcolor = "#F5F7FB",
plot_bgcolor = "#FFFFFF"
)
```
### Daily Sleep Duration Trend
```{r echo=FALSE, message=FALSE, warning=FALSE, fig.width=8, fig.height=4.2, out.width='100%'}
ggplot(qs, aes(x = date, y = sleep_hours)) +
geom_line(color = "#5B8FF9", linewidth = 1.1) +
geom_point(color = "#5B8FF9", size = 2.4) +
labs(
subtitle = "Sleep duration fluctuates across the 30-day period",
x = "Date",
y = "Sleep Hours"
) +
dashboard_theme +
theme(
axis.text.x = element_text(angle = 45, hjust = 1),
plot.title = element_text(size = 13, face = "bold"),
plot.subtitle = element_text(size = 9.5)
)
```
Row
-----------------------------------------------------------------------
### Cravings by Sleep Category
```{r echo=FALSE, message=FALSE, warning=FALSE, fig.width=8, fig.height=4.2, out.width='100%'}
ggplot(qs, aes(x = sleep_category, y = cravings_level, fill = sleep_category)) +
geom_boxplot(
alpha = 0.85,
width = 0.6,
outlier.alpha = 0.6
) +
labs(subtitle = "Cravings decrease as sleep duration increases",
x = "Sleep Category",
y = "Cravings Level"
) +
dashboard_theme +
theme(
legend.position = "none",
panel.background = element_rect(fill = "#F7F9FC", color = NA),
plot.background = element_rect(fill = "#F7F9FC", color = NA),
panel.grid.major = element_line(color = "#E3E8EF"),
panel.grid.minor = element_blank(),
plot.title = element_text(face = "bold", size = 14),
axis.title = element_text(size = 11),
axis.text = element_text(color = "#333333"),
axis.text.x = element_text(angle = 45, hjust = 1)
)
```
### 💡 Key Insights
<div class="insight-item">
<span class="icon red">↓</span>
Lower sleep durations are associated with <b>higher craving levels</b>, indicating reduced appetite control.
</div>
<div class="insight-item">
<span class="icon green">↑</span>
As sleep duration increases (7+ hours), cravings <b>decrease and stabilize</b>.
</div>
<div class="insight-item">
<span class="icon blue">↻</span>
More consistent sleep patterns align with <b>improved daily outcomes</b>.
</div>
<div class="insight-item">
<span class="icon purple">✔</span>
Sleep is a <b>key behavioral driver</b> influencing energy balance and dietary control.
</div>
🏃 Activity, Mood & Productivity
=======================================================================
### Research Question: Do higher step counts and workout minutes improve my mood and productivity?
This section examines whether higher physical activity levels, measured through steps and workout minutes, are associated with improved mood and productivity
Row
-----------------------------------------------------------------------
### Stepping Up!!!
```{r echo=FALSE}
valueBox(
value = format(round(avg_steps, 0), big.mark = ","),
caption = "Average Daily Steps",
icon = "fa-shoe-prints",
color = "green"
)
```
### Let's workout!!!
```{r}
valueBox(
value = paste0(avg_workout, " min"),
caption = "Average Workout Minutes",
icon = "fa-dumbbell",
color = "orange"
)
```
### How's the mood??
```{r}
valueBox(
value = avg_mood,
caption = "Average Mood Score",
icon = "fa-face-smile",
color = "blue"
)
```
Column {data-height=550}
-----------------------------------------------------------------------
### Interactive View: Steps vs Productivity
```{r echo=FALSE, message=FALSE, warning=FALSE, fig.width=10, fig.height=4.2, out.width='100%'}
p_steps_productivity <- ggplot(qs, aes(
x = steps,
y = productivity_score,
text = paste(
"Date:", date,
"<br>Steps:", steps,
"<br>Productivity:", productivity_score,
"<br>Mood:", mood_score,
"<br>Workout Minutes:", workout_minutes,
"<br>Activity Level:", activity_level
)
)) +
geom_point(
aes(color = activity_level),
size = 3.5,
alpha = 0.9
) +
geom_smooth(
aes(group = 1),
method = "lm",
se = FALSE,
linewidth = 1.1,
color = "#9CA3AF"
) +
scale_color_manual(
values = c(
"Low Activity" = "#D95F5F",
"Moderate Activity" = "#5B8FF9",
"High Activity" = "#61B15A"
)
) +
labs(
title = "Steps vs Productivity Relationship",
subtitle = "Higher activity levels align with improved productivity",
x = "Daily Steps",
y = "Productivity Score",
color = "Activity Level"
) +
dashboard_theme +
theme(
legend.position = "top"
)
ggplotly(p_steps_productivity, tooltip = "text") %>%
layout(
height = 350,
paper_bgcolor = "#F5F7FB",
plot_bgcolor = "#FFFFFF"
) %>%
config(displayModeBar = FALSE)
```
### Mood by Activity Level
```{r}
ggplot(qs, aes(x = activity_level, y = mood_score, fill = activity_level)) +
geom_boxplot(
alpha = 0.85,
width = 0.6,
outlier.alpha = 0.6
) +
scale_fill_manual(
values = c(
"Low Activity" = "#D95F5F",
"Moderate Activity" = "#5B8FF9",
"High Activity" = "#61B15A"
)
) +
labs(
title = "Mood by Activity Level",
subtitle = "Mood scores increase with higher activity levels",
x = "Activity Level",
y = "Mood Score"
) +
dashboard_theme +
theme(
legend.position = "none",
panel.background = element_rect(fill = "#F7F9FC", color = NA),
plot.background = element_rect(fill = "#F7F9FC", color = NA),
panel.grid.major = element_line(color = "#E3E8EF"),
panel.grid.minor = element_blank(),
plot.title = element_text(face = "bold", size = 14),
axis.title = element_text(size = 11),
axis.text = element_text(color = "#333333"),
axis.text.x = element_text(angle = 45, hjust = 1)
)
```
### 💡 Key Insights
<div class="insight-item">
<span class="icon green">↑</span>
Higher step counts are associated with <b>improved productivity scores</b>, suggesting a positive relationship between physical activity and daily performance.
</div>
<div class="insight-item">
<span class="icon blue">↗</span>
Mood scores tend to increase as activity levels move from low to moderate and high, indicating that more active days align with <b>better emotional well-being</b>.
</div>
<div class="insight-item">
<span class="icon red">↓</span>
Low activity days cluster around <b>lower mood and productivity levels</b>, showing that reduced movement may negatively affect both performance and emotional state.
</div>
<div class="insight-item">
<span class="icon purple">✔</span>
Overall, these findings suggest that physical activity is an important behavioral factor supporting <b>both mood regulation and productivity</b> in a consistent wellness routine.
</div>
🥗 Protein, Hunger & Snacking
=======================================================================
### Research Question: How does protein intake influence hunger levels and snacking behavior?
This section examines whether higher protein intake is associated with lower hunger levels and reduced snacking behavior. Protein plays an important role in satiety and appetite control, which are especially relevant in a weight-loss journey and in managing eating patterns affected by PCOS.
Row
-----------------------------------------------------------------------
### Avg Protein
```{r echo=FALSE, message=FALSE, warning=FALSE, fig.height=3.0}
valueBox(
value = paste0(round(avg_protein, 0), " g"),
caption = "Average Protein Intake",
icon = "fa-apple-alt",
color = "orange"
)
```
### Hanngryy??
```{r echo=FALSE, message=FALSE, warning=FALSE, fig.height=3.0}
valueBox(
value = avg_hunger,
caption = "Average Hunger Level",
icon = "fa-utensils",
color = "pink"
)
```
### Snacking
```{r echo=FALSE, message=FALSE, warning=FALSE, fig.height=3.0}
valueBox(
value = paste0(snack_pct, "%"),
caption = "Days with Snacking",
icon = "fa-cookie-bite",
color = "purple"
)
```
Column
----------------------------------------------------------------------
### Protein Intake vs Hunger Level
```{r echo=FALSE, message=FALSE, warning=FALSE, fig.width=8, fig.height=4.2, out.width='100%'}
ggplot(qs, aes(x = protein_g, y = hunger_level, color = protein_category)) +
geom_point(size = 5, alpha = 0.85) +
geom_smooth(method = "lm", se = FALSE, linewidth = 1, color = "black") +
scale_color_manual(
values = c(
"Low Protein" = "#D32F2F",
"Moderate Protein" = "#1976D2",
"High Protein" = "#388E3C"
)
) +
labs(
x = "Protein Intake (g)",
y = "Hunger Level",
color = "Protein Category"
) +
dashboard_theme +
theme(
axis.title = element_text(size = 11),
legend.position = "top",
panel.background = element_rect(fill = "#F7F9FC", color = NA),
plot.background = element_rect(fill = "#F7F9FC", color = NA),
panel.grid.major = element_line(color = "#E3E8EF"),
panel.grid.minor = element_blank(),
plot.title = element_text(face = "bold", size = 14),
axis.text = element_text(color = "#333333"),
axis.text.x = element_text(angle = 45, hjust = 1)
)
```
### Snacking Frequency by Protein Category
```{r echo=FALSE, message=FALSE, warning=FALSE, fig.width=8, fig.height=4.2, out.width='100%'}
ggplot(qs, aes(x = protein_category, fill = snacking)) +
geom_bar(position = "fill", alpha = 0.9) +
scale_fill_manual(
values = c(
"No" = "#66BB6A",
"Yes" = "#EF5350"
)
) +
labs(
x = "Protein Category",
y = "Proportion of Days",
fill = "Snacking"
) +
dashboard_theme +
theme(
axis.title = element_text(size = 11),
legend.position = "top",
panel.background = element_rect(fill = "#F7F9FC", color = NA),
plot.background = element_rect(fill = "#F7F9FC", color = NA),
panel.grid.major = element_line(color = "#E3E8EF"),
panel.grid.minor = element_blank(),
plot.title = element_text(face = "bold", size = 14),
axis.text = element_text(color = "#333333"),
axis.text.x = element_text(angle = 45, hjust = 1)
)
```
### Grouped by protein intake
```{r echo=FALSE, message=FALSE, warning=FALSE, fig.width=8, fig.height=4.2, out.width='100%'}
ggplot(qs, aes(x = protein_category, y = hunger_level, color = protein_category)) +
geom_jitter(width = 0.15, size = 5, alpha = 0.8) +
stat_summary(fun = mean, geom = "point", size = 5, shape = 18, color = "black") +
scale_color_manual(
values = c(
"Low Protein" = "#D32F2F",
"Moderate Protein" = "#1976D2",
"High Protein" = "#388E3C"
)
) +
labs(
x = "Protein Category",
y = "Hunger Level",
color = "Protein Category"
) +
theme_minimal() +
theme(
axis.title = element_text(size = 11),
legend.position = "top",
panel.background = element_rect(fill = "#F7F9FC", color = NA),
plot.background = element_rect(fill = "#F7F9FC", color = NA),
panel.grid.major = element_line(color = "#E3E8EF"),
panel.grid.minor = element_blank(),
plot.title = element_text(face = "bold", size = 14),
axis.text = element_text(color = "#333333"),
axis.text.x = element_text(angle = 45, hjust = 1)
)
```
Row {data-height=150}
-----------------------------------------------------------------------
### Protein Insights
The visualizations show a strong inverse relationship between protein intake and hunger levels. The scatter plot indicates that lower protein intake is consistently associated with higher hunger scores, while higher protein intake corresponds with lower and more stable hunger levels. This suggests that increasing protein intake may significantly improve satiety throughout the day.
The category-based comparison further reinforces this pattern. Low-protein days are clustered around higher hunger levels, while moderate-protein days show a noticeable reduction in hunger. High-protein days are associated with the lowest hunger levels and the least variability, indicating more consistent appetite control.
Overall, these findings highlight protein as a key nutritional factor in regulating hunger and reducing snacking behavior. For a weight-loss and PCOS management journey, maintaining adequate protein intake may support better appetite control, improve dietary consistency, and reduce the likelihood of overeating.
🍞 Carb-Dense Meals & Afternoon Crashes
=======================================================================
### Research Question: Are carb-dense meals associated with afternoon energy crashes?
This section examines whether carb-dense meals are associated with afternoon energy crashes. For weight management and PCOS, meal composition can affect energy stability, cravings, and overall consistency throughout the day.
Column
-----------------------------------------------------------------------
### Afternoon Crashes Over Time
```{r}
ggplot(qs, aes(x = date, y = ifelse(afternoon_crash == "Yes", 1, 0), color = carb_dense_meal)) +
geom_point(size = 3, alpha = 0.9) +
geom_line(aes(group = 1), color = "gray60", linewidth = 0.8) +
scale_color_manual(values = c("No" = "#2E7D32", "Yes" = "#D84315")) +
scale_y_continuous(
breaks = c(0, 1),
labels = c("No Crash", "Crash")
) +
labs(
x = "Date",
y = "Afternoon Crash",
color = "Carb-Dense Meal"
) +
theme_minimal() +
theme(
axis.text.x = element_text(angle = 45, hjust = 1),
axis.title = element_text(size = 11),
legend.position = "top"
)
```
### Interactive View: Carb-Dense Meals vs Crashes
```{r}
p_crash <- ggplot(qs, aes(
x = carb_dense_meal,
y = cravings_level,
color = afternoon_crash,
text = paste(
"Date:", date,
"<br>Carb-Dense Meal:", carb_dense_meal,
"<br>Afternoon Crash:", afternoon_crash,
"<br>Energy Score:", next_day_energy,
"<br>Cravings Level:", cravings_level
)
)) +
geom_jitter(width = 0.2, size = 3, alpha = 0.85) +
scale_color_manual(values = c("No" = "#42A5F5", "Yes" = "#E53935")) +
labs(
x = "Carb-Dense Meal",
y = "Cravings Level",
color = "Afternoon Crash"
) +
theme_minimal() +
theme(
axis.title = element_text(size = 11),
legend.position = "top"
)
ggplotly(p_crash, tooltip = "text") %>%
layout(height = 350)
```
Row {data-height=190}
-----------------------------------------------------------------------
### Carb-Dense Meal Insights
The results show that carb-dense meals are associated with a higher likelihood of afternoon crashes. Crash events frequently occur on days with carb-heavy meals, while non-carb days are mostly linked with stable energy.
Cravings also tend to be higher on carb-dense meal days, suggesting a connection between energy crashes and increased appetite.
Overall, these findings indicate that carb-heavy meals may contribute to energy instability and stronger cravings, which can affect consistency in a weight-loss and PCOS management routine.
🔁 PCOS Symptoms & Cycle Impact
=======================================================================
### Research Question: How do PCOS symptoms and cycle-related changes affect my daily habits and overall weight-loss consistency?
This section examines how cycle-related changes associated with PCOS influence daily habits, including energy, mood, cravings, and overall consistency. Hormonal fluctuations across different cycle phases can impact both physical and behavioral patterns, which may affect weight-loss progress and routine stability.
Row
-----------------------------------------------------------------------
### Cycle Phase
```{r}
valueBox(
value = most_common_phase,
caption = "Most Frequent Cycle Phase",
icon = "fa-calendar",
color = "purple"
)
```
### Energy Level
```{r}
valueBox(
value = avg_energy,
caption = "Average Energy",
icon = "fa-bolt",
color = "blue"
)
```
### Cravings
```{r}
valueBox(
value = avg_cravings,
caption = "Average Cravings",
icon = "fa-cutlery",
color = "orange"
)
```
Column
-----------------------------------------------------------------------
### Mood by Cycle Phase
```{r}
ggplot(qs, aes(x = cycle_phase, y = mood_score, fill = cycle_phase)) +
geom_boxplot(alpha = 0.85) +
labs(
x = "Cycle Phase",
y = "Mood Score"
) +
theme_minimal() +
theme(axis.text.x = element_text(angle = 20, hjust = 1))
```
### Energy by Cycle Phase
```{r}
ggplot(qs, aes(x = cycle_phase, y = next_day_energy, fill = cycle_phase)) +
geom_violin(alpha = 0.7) +
geom_boxplot(width = 0.1, fill = "white") +
labs(
x = "Cycle Phase",
y = "Energy Score"
) +
theme_minimal() +
theme(
axis.text.x = element_text(angle = 20, hjust = 1),
legend.position = "none"
)
```
### Cravings by Cycle Phas
```{r}
cravings_summary <- qs %>%
group_by(cycle_phase) %>%
summarise(avg_cravings = mean(cravings_level, na.rm = TRUE))
ggplot(cravings_summary, aes(x = cycle_phase, y = avg_cravings)) +
geom_segment(aes(xend = cycle_phase, y = 0, yend = avg_cravings),
color = "gray60", linewidth = 1.5) +
geom_point(size = 6, color = "#D32F2F") +
labs(
x = "Cycle Phase",
y = "Average Cravings Level"
) +
theme_minimal() +
theme(axis.text.x = element_text(angle = 20, hjust = 1))
```
### Habit Consistency (Good Days) by Cycle Phase
```{r}
consistency_summary <- qs %>%
group_by(cycle_phase) %>%
summarise(good_day_pct = mean(good_day == "Yes") * 100)
ggplot(consistency_summary, aes(x = cycle_phase, y = good_day_pct, fill = cycle_phase)) +
geom_col(alpha = 0.85) +
labs(
x = "Cycle Phase",
y = "Good Day Percentage"
) +
theme_minimal() +
theme(axis.text.x = element_text(angle = 20, hjust = 1))
```
Row {data-height=190}
-----------------------------------------------------------------------
### PCOS & Cycle Insights
Cycle-related changes affect mood, energy, cravings, and overall consistency. Mood and energy are higher during the follicular and ovulatory phases, while they decline in the late luteal phase.
Cravings increase in the later phases, especially in the late luteal phase, where consistency is also lowest. In contrast, the ovulatory phase shows the highest consistency along with stronger mood and energy.
Overall, these patterns suggest that cycle-related fluctuations can impact daily habits and weight-loss consistency, with some phases being more supportive than others.
✅ Conclusion
=======================================================================
Row {data-height=10}
-----------------------------------------------------------------------
### Avg Sleep
```{r echo=FALSE}
valueBox(
value = paste0(round(avg_sleep, 1), " hrs"),
caption = "Average Sleep Hours",
icon = "fa-bed",
color = "purple"
)
```
### Avg Steps
```{r}
valueBox(
value = format(round(avg_steps, 0), big.mark = ","),
caption = "Average Daily Steps",
icon = "fa-line-chart",
color = "green"
)
```
### Protein Intake
```{r}
valueBox(
value = paste0(round(avg_protein, 0), " g"),
caption = "Average Protein Intake",
icon = "fa-cutlery",
color = "orange"
)
```
### Mood & Productivity
```{r}
valueBox(
value = paste0(round(good_day_pct, 1), "%"),
caption = "High Mood & Productivity Days",
icon = "fa-smile-o",
color = "blue"
)
```
Column
-----------------------------------------------------------------------
### Conclusion matrix
```{r}
cor_df <- as.data.frame(as.table(corr_matrix))
names(cor_df) <- c("Var1", "Var2", "Correlation")
ggplot(cor_df, aes(x = Var1, y = Var2, fill = Correlation)) +
geom_tile(color = "white") +
geom_text(aes(label = round(Correlation, 2)), size = 3) +
scale_fill_gradient2(
low = "#D32F2F",
mid = "white",
high = "#388E3C",
midpoint = 0,
limits = c(-1, 1)
) +
labs(
x = "",
y = "",
fill = "Correlation"
) +
theme_minimal() +
theme(
axis.text.x = element_text(angle = 45, hjust = 1),
panel.grid = element_blank()
)
```
### Conclusion
This dashboard applied a Quantified Self approach to understand how sleep, activity, nutrition, carb-dense meals, and cycle-related changes influence my PCOS and weight-loss journey. The correlation heatmap provides an integrated view of how these factors interact rather than acting independently.
The heatmap reinforces several key patterns observed throughout the dashboard. Sleep shows a positive relationship with energy and mood, while lower sleep is associated with higher cravings. Physical activity is positively linked with mood and productivity, supporting the role of movement in improving both mental and functional well-being.
Nutritional patterns are also clearly reflected. Protein intake shows a negative relationship with hunger and cravings, while carb-dense meals align with higher cravings and energy instability. These patterns support the earlier findings that meal composition plays an important role in appetite regulation and consistency.
Cycle-related variables show associations with mood, energy, and cravings, indicating that hormonal fluctuations may influence daily habits and weight-loss consistency. Phases with lower energy and higher cravings appear to align with reduced consistency.
Overall, the heatmap highlights that my weight-loss and PCOS journey is influenced by a network of interconnected factors. Rather than a single habit driving outcomes, it is the combination of sleep, activity, nutrition, and cycle-related changes that shapes consistency and progress. This reinforces the importance of taking a holistic and adaptive approach to managing both health and routine.
Row {data-height=100}
-------------------------------------
### References
<div class="References-card">
Business Review Live. (n.d.). 8 out of 10 women revealed that PCOS had affected their self-esteem and body image [Image]. https://businessreviewlive.com/8-out-of-10-women-revealed-that-pcos-had-affected-their-self-esteem-and-body-image-2/
Quantified Self. (n.d.). Quantified Self. http://quantifiedself.com/
Tufte, E. R. (2001). The visual display of quantitative information (2nd ed.). Graphics Press.
Wexler, S., Shaffer, J., & Cotgreave, A. (2017). The big book of dashboards. Wiley.
R Core Team. (2023). R: A language and environment for statistical computing. https://www.r-project.org/
Iannone, R., Allaire, J., & Borges, B. (2020). flexdashboard: R Markdown format for flexible dashboards. https://rmarkdown.rstudio.com/flexdashboard/
Wickham, H. (2016). ggplot2: Elegant graphics for data analysis. Springer.
Teede, H. J., et al. (2018). International evidence-based guideline for the assessment and management of polycystic ovary syndrome. Human Reproduction.
Leidy, H. J., et al. (2015). The role of protein in weight loss and maintenance. American Journal of Clinical Nutrition.
</div>