Objective
Develop a visualization dashboard based on a series of data about your own life. The actual data used for this project can range from daily sleep regimes, TV shows watched, types of food eaten, spending habits, commute times to work, travel habits, to blood pressure and nutrient intake. The amount of data you collect and harvest will differ based on your specified objectives.
Ultimately the project must meet certain key objectives:
You must provide a written summary of your data collection, analysis and visualization methods, including why you chose your methods, and what tools you utilized.
Your summary must outline ≥ 5 questions that can be evaluated using a data-driven approach. These questions should be more than just “How many miles did I run”, although a couple of your questions could be stated that way.
You must collect, manage, and store the data necessary for this visualization.
You must design and create an appropriate set of visualizations (try not to use just one type of visualization) within a dashboard/storyboard that provides insight into your specified questions, with a minimum of ≥ 1 interactive graphical element.
Summary
The dataset has been imported from ‘Fitness’ app on iOS operating system, which is linked to my Apple smart watch. The watch records data like daily steps, exercise minutes, standing hours, distance traveled, and calories burned. Along with that, it also stores my sleep/idle hours throughout the day. The data is collected for the month of March 2023, during which I was participating in step challenge at my organization. The imported dataset was in .CSV format and the data was cleaned in the spreadsheets, by cleaning the date formats in all the working files and separate the date and time columns. The goal of analyzing my fitness data is to gain trends and insights from my daily activities, and build a healthier lifestyle.
Questions
To be able to learn my activity trend from my ‘Fitness’ app’s data, I have used visual analytics to drill-down the below mentioned key questions.
Q1: How many steps I walked everyday in the month of March 2023? Is it enough to be considered as a healthy count?
Based on my daily step graph, the daily step count is in the range of 1500 to 18000, which on an average comes out to be roughly around 9000 steps for the month of March 2023. However, the recommended daily steps for adult is 11,000 steps. Therefore, my daily steps is below the recommended step count and I need to increase my exercise hours.
Q2: Is my physical activity more over the weekend?
From the weekly steps distribution pie chart, I can infer that the days I walk the most are Thursday, Friday, and Tuesday (in order of percentage). The reason behind greater step count could be because those are the days when I am working from the office and I use the public transport system to commute to the office building, thus increasing the number of steps. The other days I am mostly at home and tend to slack when it comes to physical activities. To conclude, I am more physically active on weekdays compared to the weekends. I should consider working out more throughout the week to make the step count more consistent.
Q3: Is there a relationship between my daily steps and calories burned? Is it a linear regression?
Yes, there is a positive slope linear correlation between my daily steps and calories burned. Therefore, to burn the recommended consumed calories, one way is doing more physical activities including more walking hours.
Q4: How many hours do I sleep everyday in the month of March 2023? Do I get enough sleep?
From the ‘Fitness’ app’s dataset, the sleeping hours range from 5.5 to 9.6 for the month of March 2023. Based on that data, on an average I slept for roughly 7.5 hours, which is almost equal to the recommended sleeping hours (typically 8 hours are recommended for a healthy lifestyle). Though, it seems like I am not getting enough sleep (less than 7 hours of sleep) for a few days, and I should try to have a better sleep schedule.
Q5: When do I have longer sleep in a week?
From the weekly sleep hour distribution bar chart, I can infer that I have longer sleep hours over the weekend including Monday. However, the sleep hours from Tuesday to Friday are below the recommended sleep hours. To have a better work-life balance and be able to keep my work efficiency high, I should better monitor my sleep hours and not go to sleep after midnight during the weekdays.
Q6: What’s the relationship between my daily steps and daily sleeping hours? Is it a linear regression?
Yes, there is a negative slope linear correlation between my daily steps and daily sleeping hours. As the linear line has a negative slope in the scatter plot, it can be assumed that the I tend to walk more when I have less idle hours, or in other words, when I sleep more, I have a lower step count.
---
title: "ANLY 512 - Course Project"
output:
flexdashboard::flex_dashboard:
storyboard: true
social: menu
source: embed
---
### Instruction
**Objective**
Develop a visualization dashboard based on a series of data about your own life. The actual data used for this project can range from daily sleep regimes, TV shows watched, types of food eaten, spending habits, commute times to work, travel habits, to blood pressure and nutrient intake. The amount of data you collect and harvest will differ based on your specified objectives.
Ultimately the project must meet certain key objectives:
1. You must provide a written summary of your data collection, analysis and visualization methods, including why you chose your methods, and what tools you utilized.
2. Your summary must outline ≥ 5 questions that can be evaluated using a data-driven approach. These questions should be more than just “How many miles did I run”, although a couple of your questions could be stated that way.
3. You must collect, manage, and store the data necessary for this visualization.
4. You must design and create an appropriate set of visualizations (try not to use just one type of visualization) within a dashboard/storyboard that provides insight into your specified questions, with a minimum of ≥ 1 interactive graphical element.
**Summary**
The dataset has been imported from 'Fitness' app on iOS operating system, which is linked to my Apple smart watch. The watch records data like daily steps, exercise minutes, standing hours, distance traveled, and calories burned. Along with that, it also stores my sleep/idle hours throughout the day. The data is collected for the month of March 2023, during which I was participating in step challenge at my organization. The imported dataset was in .CSV format and the data was cleaned in the spreadsheets, by cleaning the date formats in all the working files and separate the date and time columns. The goal of analyzing my fitness data is to gain trends and insights from my daily activities, and build a healthier lifestyle.
**Questions**
To be able to learn my activity trend from my 'Fitness' app's data, I have used visual analytics to drill-down the below mentioned key questions.
**Q1: How many steps I walked everyday in the month of March 2023? Is it enough to be considered as a healthy count?**
Based on my daily step graph, the daily step count is in the range of 1500 to 18000, which on an average comes out to be roughly around 9000 steps for the month of March 2023. However, the recommended daily steps for adult is 11,000 steps. Therefore, my daily steps is below the recommended step count and I need to increase my exercise hours.
**Q2: Is my physical activity more over the weekend?**
From the weekly steps distribution pie chart, I can infer that the days I walk the most are Thursday, Friday, and Tuesday (in order of percentage). The reason behind greater step count could be because those are the days when I am working from the office and I use the public transport system to commute to the office building, thus increasing the number of steps. The other days I am mostly at home and tend to slack when it comes to physical activities. To conclude, I am more physically active on weekdays compared to the weekends. I should consider working out more throughout the week to make the step count more consistent.
**Q3: Is there a relationship between my daily steps and calories burned? Is it a linear regression?**
Yes, there is a positive slope linear correlation between my daily steps and calories burned. Therefore, to burn the recommended consumed calories, one way is doing more physical activities including more walking hours.
**Q4: How many hours do I sleep everyday in the month of March 2023? Do I get enough sleep?**
From the 'Fitness' app's dataset, the sleeping hours range from 5.5 to 9.6 for the month of March 2023. Based on that data, on an average I slept for roughly 7.5 hours, which is almost equal to the recommended sleeping hours (typically 8 hours are recommended for a healthy lifestyle). Though, it seems like I am not getting enough sleep (less than 7 hours of sleep) for a few days, and I should try to have a better sleep schedule.
**Q5: When do I have longer sleep in a week? **
From the weekly sleep hour distribution bar chart, I can infer that I have longer sleep hours over the weekend including Monday. However, the sleep hours from Tuesday to Friday are below the recommended sleep hours. To have a better work-life balance and be able to keep my work efficiency high, I should better monitor my sleep hours and not go to sleep after midnight during the weekdays.
**Q6: What's the relationship between my daily steps and daily sleeping hours? Is it a linear regression?**
Yes, there is a negative slope linear correlation between my daily steps and daily sleeping hours. As the linear line has a negative slope in the scatter plot, it can be assumed that the I tend to walk more when I have less idle hours, or in other words, when I sleep more, I have a lower step count.
```{r}
#Load the required libraries
library(flexdashboard)
library(dygraphs)
library(maps)
library(ggmap)
library(dplyr)
library(ggplot2)
library(maptools)
library(rgdal)
library (RCurl)
library(tidyverse)
library(plotly)
library(scatterpie)
library(rnoaa)
library(usmap)
library(mapproj)
library(knitr)
library(readr)
library(MASS)
library(lubridate)
library(gapminder)
```
### Daily Steps
```{r}
#Load daily step data
d_step_data = read.csv(file = "/Users/vaibhav/Desktop/HU 3RD SEM/ANLY 512 - Data Visualization/Course Project/Fitness Tracker Data/Daily_Steps.csv")
d_step_data$date = as.Date(d_step_data$date, format = "%m/%d/%Y")
data_plot_1 = ggplot(d_step_data, aes(x = date, y = steps)) +
geom_segment(aes(x = date, xend = date, y = 0, yend = steps), color = "grey") +
geom_point(color = "orange", size = 3) +
theme_light() +
theme(panel.grid.major.x = element_blank(),
panel.border = element_blank(),
axis.ticks.x = element_blank(),
axis.text.x = element_text(angle = 90, vjust = 0.5)) +
labs(x = "Date", y = "Daily Steps", title = "Daily Steps in March 2023")
data_plot_1
```
### Weekly Steps Distribution
```{r}
#Load weekly step data
w_step_data = read.csv(file = "/Users/vaibhav/Desktop/HU 3RD SEM/ANLY 512 - Data Visualization/Course Project/Fitness Tracker Data/Weekly_Steps.csv")
data_plot_2 = plot_ly(w_step_data,
labels = ~w_step_data$day,
values = ~w_step_data$avg_steps, type = 'pie',
textposition = 'inside',
textinfo = 'label+percent',
insidetextfont = list(color = '#FFFFFF'),
hoverinfo = 'text',
text = ~paste("Avg. Steps:", w_step_data$avg_steps),
marker = list(line = list(color = '#FFFFFF', width = 3)),
showlegend = FALSE)
data_plot_2 = data_plot_2 %>% layout(title = 'Weekly Steps Distribution - March 2023',
xaxis = list(showgrid = FALSE, zeroline = FALSE, showticklabels = FALSE),
yaxis = list(showgrid = FALSE, zeroline = FALSE, showticklabels = FALSE))
data_plot_2
```
### Relationship b/w Steps & Calories Burned in a Day
```{r}
data_plot_3 = ggplot(d_step_data, aes(x = steps, y = calories)) +
geom_point(colour = "coral", size = 3) +
labs(y = "Calories Burned", x = "Daily Steps", title = "Relationship b/w Daily Steps & Calories Burned") +
geom_smooth(method = lm, se = TRUE, color = "blue") +
theme_bw()
data_plot_3
```
### Daily Sleep Hours
```{r}
#Load daily sleep data
d_sleep_data = read.csv(file = "/Users/vaibhav/Desktop/HU 3RD SEM/ANLY 512 - Data Visualization/Course Project/Fitness Tracker Data/Daily_Sleep.csv")
d_sleep_data$date = as.Date(d_sleep_data$date, format = "%m/%d/%Y")
data_plot_4 = ggplot(d_sleep_data, aes(x = date, y = sleep_hours)) +
geom_segment(aes(x = date, xend = date, y = 0, yend = sleep_hours), color = "skyblue") +
geom_point(color = "blue", size = 3, alpha = 0.7) +
theme_light() +
coord_flip() +
theme(panel.grid.major.y = element_blank(),
panel.border = element_blank(),
axis.ticks.y = element_blank()) +
labs(x = "Date", y = "Daily Sleep Hours", title = "Daily Sleep Hours - March 2023")
data_plot_4
```
### Weekly Sleep Hour Distribution
```{r}
#Load weekly sleep data
w_sleep_data = read.csv(file = "/Users/vaibhav/Desktop/HU 3RD SEM/ANLY 512 - Data Visualization/Course Project/Fitness Tracker Data/Weekly_Sleep.csv")
data_plot_5 = plot_ly(
x = factor(w_sleep_data$day, level = c('Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun')),
y = w_sleep_data$avg_sleep_hour,
type = "bar",
#text = w_sleep_data$avg_sleep_hour,
#textposition = 'auto',
marker = list(color = 'rgba(222,45,38,0.8)',
line = list(color = 'rgb(8,48,107)', width = 1.5))
)
data_plot_5 = data_plot_5 %>% layout(title = "Weekly Sleep Ditribution",
xaxis = list(title = "Day"),
yaxis = list(title = "Average Sleep Hours"))
data_plot_5
```
### Relationship b/w Steps & Hours of Sleep in a Day
```{r}
#Load daily step and sleep data
d_step_sleep_data = read.csv(file = "/Users/vaibhav/Desktop/HU 3RD SEM/ANLY 512 - Data Visualization/Course Project/Fitness Tracker Data/Daily_Steps_&_Sleep.csv")
data_plot_6 = ggplot(d_step_sleep_data, aes(x = steps, y = sleep_hours)) +
geom_point(colour = "blueviolet", size = 3) +
labs(y = "Daily Sleep Hours", x = "Daily Steps", title = "Relationship b/w Daily Steps & Hours of Sleep") +
geom_smooth(method = lm, se = TRUE, color = "red") +
theme_bw()
data_plot_6
```