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 an written summary of your data collection, analysis and visualization methods, including the 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
Since 2020, my life has been dramatically changed since I started working from home. I have gain a lot of weight and slept less than what I did before. Therefore, I started to use IoT technologies to track my health data such as daily steps, hours of sleep, etc. In this project, I want to check my recent status by using data collected from my Fitbit hand band which including my daily steps and hour of sleep. One thing I would like to investigate is my activity and sleep pattern during a week, since I generally feel less energetic during work days. Therefore, I would like to see if my feel is a direct result of my activity and sleep quality (length). To get to know my recent status, I collected my daily steps data and hour of sleep from Sep 1st, 2021 to Sep 30th, 2021. To have better idea of the changes over a week, I averaged the data for each date of a week.By checking both the daily change graph and the change during a week, I should be able to understand my pattern much better. Also, both bar chart and pie chart would be a great way to visualize the data.
Questions
To be able to learn my health behavior and pattern from my Fitbit’s data, I investigated 5 key questions.
Q1: How many steps I walked everyday in Sep 2021? Is it enough?
Based on my daily step sep 2021 graph, my daily steps numbers are rangeed between 312 and 7462. However, the recommended daily steps for adult is 10,000 steps. Therefore, my daily steps is very low and I need to increase my exercises especially I am not going to gym during the pandemic.
Q2: What’s the relationship between my daily steps and daily consumed calories tracked by Fitbit? Is it a linear regression? Yes, there is a high linear correlation between my daily steps and daily consumed calories. Therefore, to burn the recommended consumed calories, one way is doing more physical activities including walking more.
Q3: Am I more physical active over the weekend? From the weekly steps distribution pie chart, I can easily tell that I have the most steps during the weekend. However, I have the least steps between Tuesday and Thursday. Therefore, I should build a new routine to do more exercises during the middle of a week.
Q4: How many do I sleep everyday in Sep 2021? Do I get enough sleep? Yes, both the sea level at MA and TX have raised over the last century during global warming.
Q5: When do I have longer sleep during a week? From the weekly sleep hour distribution bar chart, I can easily tell that I have longer sleep hours over the weekend including Friday. However, the sleep hour I get from Monday to Thursday is almost 1 hour short comparing to that during the weekend. It makes totally sense becuase I feel much more energetic during the weekend overall. To have better work-life balance and be able to keep my work efficiency high, I should better moniter my sleep hours and not go to sleep after midnight during the middle of a week.
---
title: "ANLY 512 Course Project"
author: "Ruohai Wang"
output:
flexdashboard::flex_dashboard:
orientation: columns
vertical_layout: fill
source_code: embed
---
```{r setup, include=FALSE}
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)
```
Introduction
===========================================
Row {}
-----------------------------------------------------------------------
### Objective
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 an written summary of your data collection, analysis and visualization methods, including the 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.
Row {}
-----------------------------------------------------------------------
### Summary
Summary
Since 2020, my life has been dramatically changed since I started working from home. I have gain a lot of weight and slept less than what I did before. Therefore, I started to use IoT technologies to track my health data such as daily steps, hours of sleep, etc. In this project, I want to check my recent status by using data collected from my Fitbit hand band which including my daily steps and hour of sleep. One thing I would like to investigate is my activity and sleep pattern during a week, since I generally feel less energetic during work days. Therefore, I would like to see if my feel is a direct result of my activity and sleep quality (length). To get to know my recent status, I collected my daily steps data and hour of sleep from Sep 1st, 2021 to Sep 30th, 2021. To have better idea of the changes over a week, I averaged the data for each date of a week.By checking both the daily change graph and the change during a week, I should be able to understand my pattern much better. Also, both bar chart and pie chart would be a great way to visualize the data.
Row {}
-----------------------------------------------------------------------
### Questions
Questions
To be able to learn my health behavior and pattern from my Fitbit's data, I investigated 5 key questions.
Q1: How many steps I walked everyday in Sep 2021? Is it enough?
Based on my daily step sep 2021 graph, my daily steps numbers are rangeed between 312 and 7462. However, the recommended daily steps for adult is 10,000 steps. Therefore, my daily steps is very low and I need to increase my exercises especially I am not going to gym during the pandemic.
Q2: What's the relationship between my daily steps and daily consumed calories tracked by Fitbit? Is it a linear regression?
Yes, there is a high linear correlation between my daily steps and daily consumed calories. Therefore, to burn the recommended consumed calories, one way is doing more physical activities including walking more.
Q3: Am I more physical active over the weekend?
From the weekly steps distribution pie chart, I can easily tell that I have the most steps during the weekend. However, I have the least steps between Tuesday and Thursday. Therefore, I should build a new routine to do more exercises during the middle of a week.
Q4: How many do I sleep everyday in Sep 2021? Do I get enough sleep?
Yes, both the sea level at MA and TX have raised over the last century during global warming.
Q5: When do I have longer sleep during a week?
From the weekly sleep hour distribution bar chart, I can easily tell that I have longer sleep hours over the weekend including Friday. However, the sleep hour I get from Monday to Thursday is almost 1 hour short comparing to that during the weekend. It makes totally sense becuase I feel much more energetic during the weekend overall. To have better work-life balance and be able to keep my work efficiency high, I should better moniter my sleep hours and not go to sleep after midnight during the middle of a week.
Daily Steps in Sep 2021
===========================================
Row {}
-----------------------------------------------------------------------
### Figure 1. Daily Steps in Sep 2021
```{r, echo=FALSE}
#Get information
mydata1 = read.csv(file="ANAL512 CourseProject Data1.csv")
mydata2 = read.csv(file="ANAL512 CourseProject Data2.csv")
f1 = ggplot(data=mydata1, aes(x=DateinSep, y=Daily_Steps)) + geom_bar(stat='identity',color = "orange")+
scale_x_discrete(limits=mydata1$DateinSep)+theme(axis.text.x=element_text(angle=90, vjust = 0.5))+labs(title="Daily Steps in Sep 2021")
f1
```
Relationship between steps and consumed calories
=====================================
Row {}
-------------------------------------
### Figure 2. Relationship between steps and consumed calories
```{r,echo = FALSE, message = FALSE}
plot(mydata1$Consumed_Calories~ mydata1$Daily_Steps,
xlim=c(0,8000),
ylim=c(0,1300),main = "Relationship between steps and consumed calories",
xlab = "Daily Steps",
ylab = "Consumed Calories")
#reg1 <- lm(mydata1$Consumed_Calories~mydata1$Daily_Steps,data=mydata1)
#abline(lm(mydata1$Consumed_Calories ~ mydata1$Daily_Steps), data=mydata1, col = "red")
#mydata1 = read.csv(file="ANAL512 CourseProject Data1.csv")
#ggplot(mydata1, aes(x=mydata1$Daily_Steps, y=mydata1$Consumed_Calories)) + geom_point(colour= "cornflowerblue") + labs(title = "Daily steps vs Daily consumed calories", x = "Daily steps", y = "Daily consumed calories")+
# scale_x_discrete(limits=mydata1$Daily_Steps) + geom_smooth(se = FALSE, method = "lm", colour="black")
```
Weekly steps distribution
=====================================
Row {}
-------------------------------------
### Figure 3. Weekly steps distribution
```{r, echo=FALSE}
mydata2 = read.csv(file="ANAL512 CourseProject Data2.csv")
pie <- ggplot(mydata2, aes(x = "", y=mydata2$Average_Steps, fill = factor(mydata2$DateinaWeek))) +
geom_bar(width = 1, stat = "identity") +
#theme(axis.line = element_blank(),
#plot.title = element_text(hjust=0.5)) +
labs(fill="Date in a week",
x=NULL,
y=NULL,
title="Steps of weekly date")
pie + coord_polar(theta = "y", start=0)
```
Daily sleep hours in Sep 2021
=====================================
Row {}
-------------------------------------
### Figure 4. Daily sleep hours in Sep 2021
```{r, echo=FALSE}
f4 = ggplot(data=mydata1, aes(x=DateinSep, y=Daily_SleepHours)) + geom_bar(stat='identity',color = "green")+
scale_x_discrete(limits=mydata1$DateinSep)+theme(axis.text.x=element_text(angle=90, vjust = 0.5))+labs(title="Daily sleep hours in Sep 2021")
f4
```
Weekly sleep hour distribution
=====================================
Row {}
-------------------------------------
### Figure 5. Weekly sleep hour distribution
```{r, echo=FALSE}
f5 = ggplot(data=mydata2, aes(x=DateinaWeek, y=Average_Sleephours)) + geom_bar(stat='identity',color = "red")+
scale_x_discrete(limits=mydata2$DateinaWeek)+theme(axis.text.x=element_text(angle=90, vjust = 0.5))+labs(title="Weekly sleep hour distribution Sep 2021")
f5
```