Introduction
About the company
Bellabeat is a high-tech manufacturer of health-focused products for women. Bellabeat is a successful small company, but they have the potential to become a larger player in the global smart device market. Urška Sršen, cofounder and Chief Creative Officer of Bellabeat, believes that analyzing smart device fitness data could help unlock new growth opport unities for the company.
Characters and products
● Characters
○ Urška Sršen: Bellabeat’s cofounder and Chief Creative Officer
○ Sando Mur: Mathematician and Bellabeat’s cofounder; key member of the Bellabeat executive team
○ Bellabeat marketing analytics team: A team of data analysts responsible for collecting, analyzing, and reporting data that helps guide Bellabeat’s marketing strategy. You joined this team six months ago and have been busy learning about Bellabeat’s mission and business goals — as well as how you, as a junior data analyst, can help Bellabeat achieve them.
● Products
○ Bellabeat app: The Bellabeat app provides users with health data related to their activity, sleep, stress, menstrual cycle, and mindfulness habits. This data can help users bett er understand their current habits and make healthy decisions. The Bellabeat app connects to their line of smart wellness products.
○ Leaf: Bellabeat’s classic wellness tracker can be worn as a bracelet, necklace, or clip. The Leaf tracker connects to the Bellabeat app to track activity, sleep, and stress.
○ Time: This wellness watch combines the timeless look of a classic timepiece with smart technology to track user activity, sleep, and stress. The Time watch connects to the Bellabeat app to provide you with insights into your daily wellness.
○ Spring: This is a water bottle that tracks daily water intake using smart technology to ensure that you are appropriately hydrated throughout the day. The Spring bott le connects to the Bellabeat app to track your hydration levels. ○ Bellabeat membership: Bellabeat also off ers a subscription-based membership program for users. Membership gives users 24/7 access to fully personalized guidance on nutrition, activity, sleep, health and beauty, and mindfulness based on their lifestyle and goals
Business task/Goals for the analysis
Tools to be used: Google Sheets, R Programming, Tableau
For this project, I will use Google Sheets for viewing .cvs files for cleaning purposes. Then I will use R to process the data for data manipulation and visualizations. Tableau will also be used for visualization.
Data sources For this project, I will use FitBit Fitness Tracker Data.
Datasets are downloaded and stored on local storage with .cvs format.
About the Dataset
This dataset generated by respondents to a distributed survey via Amazon Mechanical Turk between 03.12.2016-05.12.2016. Thirty eligible Fitbit users consented to the submission of personal tracker data, including minute-level output for physical activity, heart rate, and sleep monitoring. Individual reports can be parsed by export session ID (column A) or timestamp (column B). Variation between output represents use of different types of Fitbit trackers and individual tracking behaviors / preferences.
In this project, I will use Google Sheets to check the data for data validation and cleaning. Added Two columns for each data sheets named: ActivityDate and Weekday This is done by converting the existing Dates column into custom date and time format to only display “mm/dd/yyyy” format for ActivityDate and “Monday, Tuesday, Wednesday, Thurday, Friday, Saturday, or Sunday” format on Weekday column.
I will be using these datasets for the analysis:
These are some of the datasets that is cleaned and added with ActivityDate and Weekday column.
Next we’ll be using R to count total participants in each data sets
library(tidyverse)
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ dplyr 1.1.4 ✔ readr 2.1.5
## ✔ forcats 1.0.0 ✔ stringr 1.5.1
## ✔ ggplot2 3.4.4 ✔ tibble 3.2.1
## ✔ lubridate 1.9.3 ✔ tidyr 1.3.1
## ✔ 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(lubridate)
library(dplyr)
library(ggplot2)
library(tidyr)
sleep <- read.csv("sleepDay_merged.csv")
n_distinct(sleep$Id)
## [1] 24
24
There are total of 24 participants in the dataset that I am processing now.
Data Analysis and Visualization of the total 24 participants in Average sleep per day
sleep$Weekday <- factor(sleep$Weekday, levels = c("Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"))
average_sleep <- aggregate(TotalMinutesAsleep ~ Weekday, data = sleep, FUN = mean)
ggplot(data = average_sleep, aes(x = Weekday, y = TotalMinutesAsleep)) +
geom_bar(stat = "identity", fill = "skyblue") +
labs(x = "Weekday", y = "Average Sleep Minutes", title = "Average Sleep Minutes per Day in a Week")
Data Analysis and Visualization of the total 24 participants in Weekday Vs total Minutes Asleep
sleep$Weekday <- factor(sleep$Weekday, levels = c("Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"))
# Plot with sorted x-axis
ggplot(data = sleep, aes(x = Weekday, y = TotalMinutesAsleep)) +
geom_bar(stat = "identity", width = 0.8, fill = 'darkblue') +
labs(title = "Bar Plot of Total Sleep Minutes by Weekday") +
theme(axis.text.x = element_text(angle = 45, hjust = 1)) # Rotate x-axis labels for better readability
Next process, I will be merging the steps and calories data sets to analyze and visualize the relationship of the two parameters.
calories <- read.csv("dailyCalories_merged.csv")
steps <- read.csv("dailySteps_merged.csv")
merged_steps_calories <- merge(calories, steps, by = c("Id", "ActivityDate", "Weekday"), all = FALSE)
head(merged_steps_calories)
## Id ActivityDate Weekday Calories StepTotal
## 1 1503960366 4/12/2016 Tuesday 1985 13162
## 2 1503960366 4/13/2016 Wednesday 1797 10735
## 3 1503960366 4/14/2016 Thursday 1776 10460
## 4 1503960366 4/15/2016 Friday 1745 9762
## 5 1503960366 4/16/2016 Saturday 1863 12669
## 6 1503960366 4/17/2016 Sunday 1728 9705
Plotting the Total Steps Vs Calories
ggplot(data=merged_steps_calories) + geom_point() + aes(x=StepTotal,y=Calories) +
geom_smooth() + labs(title = "Total Steps vs Calories")
## `geom_smooth()` using method = 'loess' and formula = 'y ~ x'
Graphing the relationship of total steps throughout the week
merged_steps_calories$Weekday <- factor(merged_steps_calories$Weekday, levels = c("Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"))
ggplot(data = merged_steps_calories, aes(x = Weekday, y = StepTotal)) +
geom_bar(stat = "identity", width = 0.9, fill = 'aquamarine3') +
labs(title = "Total Steps throughout the week") +
theme(axis.text.x = element_text(angle = 45, hjust = 1))
Total Calories in a week
merged_steps_calories$Weekday <- factor(merged_steps_calories$Weekday, levels = c("Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"))
ggplot(data = merged_steps_calories, aes(x = Weekday, y = Calories)) +
geom_bar(stat = "identity", width = .9, fill = 'cyan4') +
labs(title = "Total Calories throughout the week") +
theme(axis.text.x = element_text(angle = 45, hjust = 1))
Next, I will check the data stored in weightloginfo data set to check participants’ weight info.
weight <- read.csv("weightLogInfo_merged.csv")
str(weight)
## 'data.frame': 67 obs. of 10 variables:
## $ Id : num 1.50e+09 1.50e+09 1.93e+09 2.87e+09 2.87e+09 ...
## $ ActivityDate : chr "5/2/2016" "5/3/2016" "5/4/2016" "5/5/2016" ...
## $ Weekday : chr "Monday" "Tuesday" "Wednesday" "Thursday" ...
## $ Date : chr "5/2/2016 11:59:59 PM" "5/3/2016 11:59:59 PM" "4/13/2016 1:08:52 AM" "4/21/2016 11:59:59 PM" ...
## $ WeightKg : num 52.6 52.6 133.5 56.7 57.3 ...
## $ WeightPounds : num 116 116 294 125 126 ...
## $ Fat : int 22 NA NA NA NA 25 NA NA NA NA ...
## $ BMI : num 22.6 22.6 47.5 21.5 21.7 ...
## $ IsManualReport: logi TRUE TRUE FALSE TRUE TRUE TRUE ...
## $ LogId : num 1.46e+12 1.46e+12 1.46e+12 1.46e+12 1.46e+12 ...
n_distinct(weight$Id)
## [1] 8
Total of 8 participants who logged their weight info on the dataset.
Taking the Average weight in Kg of each participants.
weight_average <- weight %>%
group_by(Id) %>%
summarise(weight_mean = mean(WeightKg, na.rm = TRUE)) %>%
arrange(weight_mean)
print(weight_average)
## # A tibble: 8 × 2
## Id weight_mean
## <dbl> <dbl>
## 1 1503960366 52.6
## 2 2873212765 57
## 3 6962181067 61.6
## 4 4558609924 69.6
## 5 4319703577 72.4
## 6 8877689391 85.1
## 7 5577150313 90.7
## 8 1927972279 134.
With a limited number of participants who logged their weight data,we cannot use this dataset to perform an analysis.
Processing hourly calories and hourly steps data sets.
hourly_calories <- read.csv("hourlyCalories_merged.csv")
hourly_steps <- read.csv("hourlySteps_merged.csv")
colnames(hourly_calories)
## [1] "Id" "Hour" "ActivityHour" "Calories"
colnames(hourly_steps)
## [1] "Id" "Hour" "ActivityHour" "StepTotal"
merged_hourly_steps_calories <- merge(hourly_calories, hourly_steps, by = c("Id", "Hour", "ActivityHour"), all = FALSE)
n_distinct(merged_hourly_steps_calories$Id)
## [1] 33
head(merged_hourly_steps_calories)
## Id Hour ActivityHour Calories StepTotal
## 1 1503960366 00:00 4/12/2016 12:00:00 AM 81 373
## 2 1503960366 00:00 4/13/2016 12:00:00 AM 69 144
## 3 1503960366 00:00 4/14/2016 12:00:00 AM 56 81
## 4 1503960366 00:00 4/15/2016 12:00:00 AM 60 83
## 5 1503960366 00:00 4/16/2016 12:00:00 AM 77 459
## 6 1503960366 00:00 4/17/2016 12:00:00 AM 47 0
Plotting Hourly steps vs calories
ggplot(data=merged_hourly_steps_calories) + geom_point() + aes(x=StepTotal,y=Calories) +
geom_smooth() + labs(title = "Hourly Total Steps vs Calories")
## `geom_smooth()` using method = 'gam' and formula = 'y ~ s(x, bs = "cs")'
Graphing Total steps taken by each participants in a day
ggplot(data = merged_hourly_steps_calories, aes(x = Hour, y = StepTotal)) +
geom_bar(stat = "identity", width = 0.9, fill = 'azure4') +
labs(title = "Total Steps throughout the Day") +
theme(axis.text.x = element_text(angle = 45, hjust = 1))
Graphing Total calories burned by each participants in a day
ggplot(data = merged_hourly_steps_calories, aes(x = Hour, y = Calories)) +
geom_bar(stat = "identity", width = 0.9, fill = 'cadetblue') +
labs(title = "Total Calories throughout the Day") +
theme(axis.text.x = element_text(angle = 45, hjust = 1))
Active Minutes Analysis and Visualization using Tableau
In these bar graphs, Sundays have the record of the best average sleep minutes in the whole week. Sleeping for long hours on Sundays help the participants get back the energy they spent during the entire week. We also find a decrease in participants’ sleep frequency and length on Mondays, which could be attributed to participants having to go to work on Monday and/or preparing the family for work or school. Sleep quality improves gradually and peaks on Wednesdays. Sleep quality then worsens until Friday, when we can presume the participants’ party/nightlife activities may influence their sleep patterns, leading to decreased sleep quality compared to earlier in the week.
In this scatterplots of total steps and calories burned, we see positive correlation between the two variables, which is obvious.
In the bar graphs depicting Total Steps and Total Calories over the course of the week, a clear trend emerges showing that an increase in steps correlates with a rise in total calories burned. According to the data, both steps and calories reach their highest point on Tuesday. These findings are consistent with the positive correlation observed in the previous scatterplot analysis of steps and calories.
This graph depicts total steps and calories per hour throughout the day based on participant averages. Peak step counts were obtained between 6:00 and 7:00 p.m. During this time, the highest number of calories burned were reported. The participants were likely at their most active throughout this period.
In this Tableau pie chart, we can see the total minutes of all 33 participant in different activities throughout the day where Sedentary minutes tops the chart with a total percentage of 81% total Sedentary minutes.