Data Preparation

Column

Data Preperation

Activity Data in 2018
Month Day Calories_Burned Steps Distance Daily_Calories_Burned Daily_Steps Daily_Distance Calories_Burned_per_Step Centimeter_per_Step
Jan 31 54896 225574 95.51 1770.839 7276.581 3.080968 0.2433614 68.14103
Feb 28 49471 195739 84.26 1766.821 6990.679 3.009286 0.2527396 69.27762
Mar 31 58081 258835 109.29 1873.581 8349.516 3.525484 0.2243939 67.95264
Apr 30 57071 266645 112.86 1902.367 8888.167 3.762000 0.2140336 68.11700
May 31 58470 269941 113.86 1886.129 8707.774 3.672903 0.2166029 67.88147
Jun 30 50666 183143 76.58 1688.867 6104.767 2.552667 0.2766472 67.29362
Jul 31 39401 159077 66.36 1271.000 5131.516 2.140645 0.2476851 67.13483
Aug 31 49085 135011 56.14 1583.387 4355.194 1.810968 0.3635630 66.91942
Sep 30 49861 138702 57.93 1662.033 4623.400 1.931000 0.3594829 67.21554
Oct 31 56819 240002 102.72 1832.871 7742.000 3.313548 0.2367439 68.87935
Nov 30 53259 187470 80.89 1775.300 6249.000 2.696333 0.2840935 69.44036
Dec 31 58820 227629 95.20 1897.419 7342.871 3.070968 0.2584029 67.30669

Here is my activity data in 2018, I prepared three types of data:

  1. Monthly data
  • Calories Burned
  • Steps
  • Distance (Mile)
  1. Daily data = monthly / day in a month
  • Calories Burned
  • Steps
  • Distance (Mile)
  1. Calculated per step data
  • Calories Burned per step
  • Distance per step (Centimeter)

Activity Analysis

Column

Monthly Calories Burned

Monthly Distance

Monthly Steps

Column

Daily Calories Burned

Daily Distance

Daily Steps

Column

Calories Burned per Step

Distance per Step

Calories vs. Distance per Step

---
title: "The Quantified Self"
author: "Qiong Duan"
date: "December 6, 2019"
output: 
  flexdashboard::flex_dashboard:
    orientation: columns
    vertical_layout: fill
    source_code: embed
---
---

```{r setup, include=FALSE}
library(flexdashboard)
library(readxl)
```




Data Preparation {data-orientation=columns}
==========================================================================

Sidebar {.sidebar data-width=300}
-----------------------------------------------------------------------
### My Activity Report in 2018

1. How many calories I burned per month and day?
On average, I burned 52,992 calories per month and 1,743 calories per day. Based on the research "An average woman needs to burn 1500 calories per day to lose one pound of weight per week", I should be fit in this way. 2. What is the driver of the number of calories burned? Is there any pattern?
My main activity for exercise is walk - so my guess is that the number of steps and distance are postive correlated with the calories I burned. Based on the graph, they do have a positive correlation. I did more activity during winter and spring and burned more calories; while during summer and fall, I tend to walk less and burn less calories. 3. Any difference between monthly and daily numbers?
No, they are basically aligned. February is the only exception because it only has 28 days. The daily calories burned / distance / steps in February are all above average, while the total monthly numbers are lower than the average. 4. Any interesting findings for the "per step" numbers?
During summer, even though I tend to do less activity and walk less, I burned calories more efficiently. I burned more than 0.36 calories per step during hot season, which is 1/3 more than the average calories per step I burned among the entire year. The weather does help me a lot! 5. How can I burn more calories?
Another interesting finding is that per one step - I tend to burn more calories and have a shorter stride during summer season. There is a negative correlation between the calories burned and distance per step. We can say both of the hot weather and shorter stride may drive the efficiency of calories burn. Column ----------------------------------------------------------------------- ### Data Preperation ```{r} setwd("/Users/carolduan/Documents/HU/512/") activity_data <- read_excel("Carol's Activity by month.xlsx") knitr::kable(activity_data, caption = "Activity Data in 2018") ``` *** Here is my activity data in 2018, I prepared three types of data: 1. Monthly data - Calories Burned - Steps - Distance (Mile) 2. Daily data = monthly / day in a month - Calories Burned - Steps - Distance (Mile) 3. Calculated per step data - Calories Burned per step - Distance per step (Centimeter) Activity Analysis {data-orientation=columns} ========================================================================== Sidebar {.sidebar data-width=300} ----------------------------------------------------------------------- ### My Activity Report in 2018 1. How many calories I burned per month and day?
On average, I burned 52,992 calories per month and 1,743 calories per day. Based on the research "An average woman needs to burn 1500 calories per day to lose one pound of weight per week", I should be fit in this way. 2. What is the driver of the number of calories burned? Is there any pattern?
My main activity for exercise is walk - so my guess is that the number of steps and distance are postive correlated with the calories I burned. Based on the graph, they do have a positive correlation. I did more activity during winter and spring and burned more calories; while during summer and fall, I tend to walk less and burn less calories. 3. Any difference between monthly and daily numbers?
No, they are basically aligned. February is the only exception because it only has 28 days. The daily calories burned / distance / steps in February are all above average, while the total monthly numbers are lower than the average. 4. Any interesting findings for the "per step" numbers?
During summer, even though I tend to do less activity and walk less, I burned calories more efficiently. I burned more than 0.36 calories per step during hot season, which is 1/3 more than the average calories per step I burned among the entire year. The weather does help me a lot! 5. How can I burn more calories?
Another interesting finding is that per one step - I tend to burn more calories and have a shorter stride during summer season. There is a negative correlation between the calories burned and distance per step. We can say both of the hot weather and shorter stride may drive the efficiency of calories burn. Column {.tabset .tabset-fade data-height=400} ----------------------------------------------------------------------- ### Monthly Calories Burned ```{r} library(grid) library(gridExtra) library(ggplot2) library(hrbrthemes) activity_data$Month <- as.character(activity_data$Month) activity_data$Month <- factor(activity_data$Month, levels=unique(activity_data$Month)) grob <- grobTree(textGrob("Mean: 52,992", x=0.80, y=.93, hjust=0, gp=gpar(col="red", fontsize=10, fontface="italic"))) ggplot(activity_data, aes(x=Month, y=Calories_Burned))+ geom_histogram(stat = "identity", fill="#69b3a2", color="#e9ecef", alpha=0.9) + ggtitle("Monthly Calories Burned in 2018") + theme_ipsum() + theme(plot.title = element_text(size=15), axis.title=element_blank())+ geom_hline(yintercept=52992,linetype="dashed", color = "red") + annotation_custom(grob) ``` ### Monthly Distance ```{r} library(grid) library(gridExtra) library(ggplot2) library(hrbrthemes) activity_data$Month <- as.character(activity_data$Month) activity_data$Month <- factor(activity_data$Month, levels=unique(activity_data$Month)) grob <- grobTree(textGrob("Mean: 88", x=0.85, y=.80, hjust=0, gp=gpar(col="red", fontsize=10, fontface="italic"))) ggplot(activity_data, aes(x=Month, y=Distance))+ geom_histogram(stat = "identity", fill="#E69F00", color="#e9ecef", alpha=0.9) + ggtitle("Monthly Walking Distance in 2018 (Mile)") + theme_ipsum() + theme(plot.title = element_text(size=15), axis.title=element_blank())+ geom_hline(yintercept=87.63,linetype="dashed", color = "red") + annotation_custom(grob) ``` ### Monthly Steps ```{r} grob <- grobTree(textGrob("Mean: 207,314", x=0.80, y=.6, hjust=0, gp=gpar(col="red", fontsize=10, fontface="italic"))) ggplot(activity_data, aes(x=Month, y=Steps, group = 1))+ geom_line()+ ggtitle("Monthly Steps in 2018") + theme_ipsum() + theme(plot.title = element_text(size=15), axis.title=element_blank())+ geom_hline(yintercept=207314,linetype="dashed", color = "red") + annotation_custom(grob) ``` Column {.tabset .tabset-fade data-height=400} ----------------------------------------------------------------------- ### Daily Calories Burned ```{r} library(ggplot2) library(hrbrthemes) grob <- grobTree(textGrob("Mean: 1,743", x=0.80, y=.93, hjust=0, gp=gpar(col="red", fontsize=10, fontface="italic"))) ggplot(activity_data, aes(x=Month, y=Daily_Calories_Burned))+ geom_histogram(stat = "identity", fill="#69b3a2", color="#e9ecef", alpha=0.9) + ggtitle("Daily Calories Burned in 2018") + theme_ipsum() + theme(plot.title = element_text(size=15), axis.title=element_blank())+ geom_hline(yintercept=1743,linetype="dashed", color = "red") + annotation_custom(grob) ``` ### Daily Distance ```{r} library(grid) library(gridExtra) library(ggplot2) library(hrbrthemes) activity_data$Month <- as.character(activity_data$Month) activity_data$Month <- factor(activity_data$Month, levels=unique(activity_data$Month)) grob <- grobTree(textGrob("Mean: 3", x=0.85, y=.80, hjust=0, gp=gpar(col="red", fontsize=10, fontface="italic"))) ggplot(activity_data, aes(x=Month, y=Daily_Distance))+ geom_histogram(stat = "identity", fill="#E69F00", color="#e9ecef", alpha=0.9) + ggtitle("Daily Walking Distance in 2018 (Mile)") + theme_ipsum() + theme(plot.title = element_text(size=15), axis.title=element_blank())+ geom_hline(yintercept=2.88,linetype="dashed", color = "red") + annotation_custom(grob) ``` ### Daily Steps ```{r} grob <- grobTree(textGrob("Mean: 6,813", x=0.80, y=.6, hjust=0, gp=gpar(col="red", fontsize=10, fontface="italic"))) ggplot(activity_data, aes(x=Month, y=Daily_Steps, group = 1))+ geom_line()+ ggtitle("Daily Steps in 2018") + theme_ipsum() + theme(plot.title = element_text(size=15), axis.title=element_blank())+ geom_hline(yintercept=6813,linetype="dashed", color = "red") + annotation_custom(grob) ``` Column {.tabset .tabset-fade data-height=400} ----------------------------------------------------------------------- ### Calories Burned per Step ```{r} grob <- grobTree(textGrob("Mean: 0.26", x=0.85, y=0.25, hjust=0, gp=gpar(col="red", fontsize=10, fontface="italic"))) ggplot(activity_data, aes(x=Month, y=Calories_Burned_per_Step, group = 1))+ geom_point(color="#69b3a2")+ geom_line(color="#69b3a2")+ ggtitle("Calories Burned per Step") + theme_ipsum() + theme(plot.title = element_text(size=15), axis.title=element_blank())+ geom_hline(yintercept=0.26,linetype="dashed", color = "red") + annotation_custom(grob) ``` ### Distance per Step ```{r} grob <- grobTree(textGrob("Mean: 68", x=0.85, y=0.50, hjust=0, gp=gpar(col="red", fontsize=10, fontface="italic"))) ggplot(activity_data, aes(x=Month, y=Centimeter_per_Step, group = 1))+ geom_point(color="#E69F00")+ geom_line(color="#E69F00")+ ggtitle("Distance per Step (Centimeter)") + theme_ipsum() + theme(plot.title = element_text(size=15), axis.title=element_blank())+ geom_hline(yintercept=67.96,linetype="dashed", color = "red") + annotation_custom(grob) ``` ### Calories vs. Distance per Step ```{r} ggplot(activity_data, aes(x=Centimeter_per_Step, y=Calories_Burned_per_Step, group = 1))+ geom_point()+ geom_smooth(method=lm)+ ggtitle("Calories vs. Distance per Step") + xlab("Distance per Step (Centimeter)") + ylab("Calories per Step")+ theme_ipsum() + theme(plot.title = element_text(size=15)) ```