Instruction

Overview

The Quantified Self (QS) is a movement motivated to leverage the synergy of wearables, analytics, and “Big Data”. This movement exploits the ease and convenience of data acquisition through the internet of things (IoT) to feed the growing obsession of personal informatics and quotidian data. The website http://quantifiedself.com/ is a great place to start to understand more about the QS movement.

The value of the QS for our class is that its core mandate is to visualize and generate questions and insights about a topic that is of immense importance to most people - themselves. It also produces a wealth of data in a variety of forms. Therefore, designing this project around the QS movement makes perfect sense because it offers you the opportunity to be both the data and question provider, the data analyst, the vis designer, and the end user. This means you will be in the unique position of being capable of providing feedback and direction at all points along the data visualization/analysis life cycle.

Introduction

This Dashboard show the Analysis of the Fitbit data between 2019 January to December. The motivation behind this analysis is, I have been using Fitbit to tack my daily physical state such as Calories, Steps, Floor, exercises etc. This dashboard show the analysis and trend between different Fitbit stats.

I have downloaded the data from Fitbit.com in excel format and imported in R using read_excel function.

In this Analysis I want to explore and answer below questions,

  1. Trend between steps and Calories throughout the year 2019.
  2. Which type of activity contribute more to total activity calories.
  3. Trend between calories burned and physical active state.
  4. Correlation between calories burned and Activity calories
  5. Does the pattern for walking distance and floors climed remain same throughout the year?

Motivation

I thought it may be helpful to provide my motivations behind assigning this project. I have for a long time had an obsession with lifelogging of a quantified nature. My attempts have cluttered hard drives going back more than a decade. However, recently I stumbled across a project that showed a maturity and obsession that surpassed even my own. From 2005-2014 Nicholas Feltron monitored most aspects of this life with considerable detail and then designed, built and distributed an annual report. To support the collection of this information he also built a number of apps.

If you review these links you will see a collection of vis that are well designed, powerful communications of a man’s life. But there static nature lacks some interesting dynamics. I want our project to go further, I want to also leverage the power of dynamic visualization so that insights do not exist in a static vacuum but can drive greater inferences and deeper insights into an important subject, yourselves.

Fitbit Data Summary

      Date            Calories_Burned     Steps          Distance    
 Min.   :2019-01-01   Min.   :1803    Min.   :    0   Min.   :0.000  
 1st Qu.:2019-04-02   1st Qu.:2207    1st Qu.: 3078   1st Qu.:1.440  
 Median :2019-07-02   Median :2458    Median : 4030   Median :1.940  
 Mean   :2019-07-02   Mean   :2474    Mean   : 4311   Mean   :2.148  
 3rd Qu.:2019-10-01   3rd Qu.:2677    3rd Qu.: 5141   3rd Qu.:2.620  
 Max.   :2019-12-31   Max.   :4677    Max.   :21374   Max.   :9.800  
     Floors       Minutes_Sedentary Minutes_Lightly_Active
 Min.   : 0.000   Min.   : 549      Min.   :  0.0         
 1st Qu.: 0.000   1st Qu.: 818      1st Qu.: 37.0         
 Median : 2.000   Median :1140      Median :100.0         
 Mean   : 3.219   Mean   :1099      Mean   :104.3         
 3rd Qu.: 5.000   3rd Qu.:1393      3rd Qu.:161.0         
 Max.   :37.000   Max.   :1440      Max.   :388.0         
 Minutes_Fairly_Active Minutes_Very_Active Activity_Calories
 Min.   :  0.000       Min.   : 0.000      Min.   :   0.0   
 1st Qu.:  0.000       1st Qu.: 0.000      1st Qu.: 167.0   
 Median :  0.000       Median : 0.000      Median : 559.0   
 Mean   :  4.444       Mean   : 4.685      Mean   : 577.3   
 3rd Qu.:  1.000       3rd Qu.: 0.000      3rd Qu.: 804.0   
 Max.   :111.000       Max.   :87.000      Max.   :3006.0   

Monthly Avg Steps and Calories Burned


This graph shows the total steps in a month throughout the year 2019. We can see overall trend is good. Avg Maximum number of steps was recorded in April 2019 also in same month higest avg calories were burned However minimum number of steps recorded in December month. We can see that may be because of winter number of steps went down in December.

Calories burned vs Different activity


This graph show the Calories burned vs Light activity, Steps, Sedentary and Floors. From the graph we can see that Steps and floors are highly contributing to calories burned during the day. However, Sedentary activity is negativity correlated with calories burned.

contribution of Physical State to Total activity calories


This graph show the trend between different type of active status such as Light, Fair and very. From the graph we can see that light activity such as running, walking etc. contributing more tom the total activity calories however; based on very active trend we can see that calories contribution to total activity calories is very less.

Trend between Active Calories vs Burned Calories


This graph show the trend between calories burned Vs activity calories. Based on the graph we can see that both trend are the same. Also we can see that same spikes in both line during the same time.

Trend Between Distance and Floor throughout the year.


This Interactive graph shows the daily distance and floor climbed trend throughout the year. From the graph we can see that maximum distance walked is around 10 mile and maximum floor climbed is 37 on 9/29/2019.

Conclusion and Answers

Question Answer

  1. Trend between steps and Calories throughout the year 2019.
  1. Which type of activity contribute more to total activity calories.
  1. Trend between calories burned and physical activity.
  1. Correlation between calories burned and activity calories
  1. Does the pattern for walking distance and floors climed remain same throughout the year?

Conlcusion

Based on this analysis, we can conclude highest Avg number of steps recorded in April 6556. The highest Avg Calories burned is 2827 recorded in same month. Also we can see that Climbing floor and Walking are contributing more to Calories Burned. Also Light physical active state is also contributing more to the Activity calories then Fairly and Very activity.

---
title: "Project ANLY 512 Data Exploration and Analysis - Rajan Patel"
auther: "Rajan Patel"
output: 
  flexdashboard::flex_dashboard:
    storyboard: true
    social: menu
    source: embed
---


### Instruction

**Overview** 

The Quantified Self (QS) is a movement motivated to leverage the synergy of wearables, analytics, and “Big Data”. This movement exploits the ease and convenience of data acquisition through the internet of things (IoT) to feed the growing obsession of personal informatics and quotidian data. The website http://quantifiedself.com/ is a great place to start to understand more about the QS movement.

The value of the QS for our class is that its core mandate is to visualize and generate questions and insights about a topic that is of immense importance to most people - themselves. It also produces a wealth of data in a variety of forms. Therefore, designing this project around the QS movement makes perfect sense because it offers you the opportunity to be both the data and question provider, the data analyst, the vis designer, and the end user. This means you will be in the unique position of being capable of providing feedback and direction at all points along the data visualization/analysis life cycle.

**Introduction** 

This Dashboard show the Analysis of the Fitbit data between 2019 January to December. The motivation behind this analysis is, I have been using Fitbit to tack my daily physical state such as Calories, Steps, Floor, exercises  etc. This dashboard show the analysis and trend between different Fitbit stats. 

I have downloaded the data from Fitbit.com in excel format and imported in R using read_excel function.

In this Analysis I want to explore and answer below questions,

  1. Trend between steps and Calories throughout the year 2019.
  2. Which type of activity contribute more to total activity calories.
  3. Trend between calories burned and physical active state.
  4. Correlation between calories burned and Activity calories 
  5. Does the pattern for walking distance and floors climed remain same throughout the year?
  
  

***

**Motivation**

I thought it may be helpful to provide my motivations behind assigning this project. I have for a long time had an obsession with lifelogging of a quantified nature. My attempts have cluttered hard drives going back more than a decade. However, recently I stumbled across a project that showed a maturity and obsession that surpassed even my own. From 2005-2014 Nicholas Feltron monitored most aspects of this life with considerable detail and then designed, built and distributed an annual report. To support the collection of this information he also built a number of apps.

If you review these links you will see a collection of vis that are well designed, powerful communications of a man’s life. But there static nature lacks some interesting dynamics. I want our project to go further, I want to also leverage the power of dynamic visualization so that insights do not exist in a static vacuum but can drive greater inferences and deeper insights into an important subject, yourselves.

```{r setup, include=FALSE}
library(flexdashboard)
library(readxl)
library(lubridate)
library(dplyr)
library(ggplot2)
library(cowplot)
library(gridExtra)
library(plotly)
fitbit_2019 <- read_excel("~/Downloads/Archive/fitbit_export_2019.xls")
fitbit_2019$Date <- as.Date(fitbit_2019$Date)
fitbit_2019$Steps <- as.numeric(fitbit_2019$Steps)
fitbit_2019$Calories_Burned <- as.numeric(fitbit_2019$Calories_Burned)
```

### Fitbit Data Summary
```{r}
summary(fitbit_2019)
```
***

### Monthly Avg Steps and Calories Burned

```{r}
#Avg Monthly steps
graph_1 = fitbit_2019 %>%
   group_by(month = floor_date(Date, "month")) %>%
   summarize(Steps = mean(Steps),Calories_Burned = mean(Calories_Burned))

graph_1$Steps = round(graph_1$Steps, digits = 0)
graph_1$Calories_Burned = round(graph_1$Calories_Burned, digits = 2)
   
  
Steps_plot =ggplot(graph_1, aes(x=month, y=Steps)) +
            geom_bar(stat="identity", fill="steelblue") +
            geom_text(aes(label=Steps), vjust=1.6, color="black",
            position = position_dodge(0.9), size=2.5)+
            theme_minimal()+
            labs(title="Monthly Avg Steps", x="Months", y="Number of Steps")

Cal_plot=   ggplot(graph_1, aes(x=month, y=Calories_Burned))+
            geom_point(size=2, shape=23)+
            geom_line()+
            theme_minimal() +
            geom_text(aes(label=Calories_Burned), vjust=1.6, color="black",
            position = position_dodge(0.9), size=4.5)+
            labs(title="Monthly Avg Calories", x="Months", y="Calories Burned")

grid.arrange(Steps_plot,Cal_plot, ncol=1)
  

```

***

This graph shows the total steps in a month throughout the year 2019. We can see overall trend is good. Avg Maximum number of steps was recorded in April 2019 also in same month higest avg calories were burned However minimum number of steps recorded in December month. We can see that may be because of winter number of steps went down in December. 


### Calories burned vs Different activity

```{r}

plot_1 = ggplot(fitbit_2019, aes(x=Minutes_Lightly_Active, y=Calories_Burned)) +
         geom_point(size=1, color ="black")+
         geom_smooth(method=lm, se=FALSE) +
         theme_minimal() +
         labs(title="Lightly Activity Vs Calories Burned", x="Lightly Activity Time (Min)", y="Calories Burned") 
  
plot_2 = ggplot(fitbit_2019, aes(x=Steps, y=Calories_Burned))+ 
         geom_point(size=1, color ="black")+
         geom_smooth(method=lm, se=FALSE) +
         theme_minimal() +
         labs(title="Steps Vs Calories Burned", x="Steps", y="Calories Burned") 

plot_3 = ggplot(fitbit_2019, aes(x=Minutes_Sedentary, y=Calories_Burned))+
         geom_point(size=1, color ="black")+
         geom_smooth(method=lm, se=FALSE) +
         theme_minimal() +
         labs(title="Sedentary Vs Calories Burned", x="Sedentary (Min)", y="Calories Burned") 

plot_4 = ggplot(fitbit_2019, aes(x=Floors, y=Calories_Burned)) + 
         geom_point(size=1, color ="black") +
         geom_smooth(method=lm, se=FALSE) +
        theme_minimal() +
        labs(title="Floors Vs Calories Burned", x="Floors", y="Calories Burned")

grid.arrange(plot_1,plot_2,plot_3,plot_4, ncol=2) 
```

***

This graph show the Calories burned vs Light activity, Steps, Sedentary and Floors. From the graph we can see that Steps and floors are highly contributing to calories burned during the day. However, Sedentary activity is negativity correlated with calories burned.   

### contribution of Physical State to Total activity calories

```{r}

fitbit_2019_Activity = fitbit_2019[,c(1,7,8,9,10)]

names(fitbit_2019_Activity)[2] = "Light_Active"
names(fitbit_2019_Activity)[3] = "Fairly_Active"
names(fitbit_2019_Activity)[4] = "Very_Active"

fitbit_2019_Activity_melted = reshape2::melt(fitbit_2019_Activity, id=c('Date','Activity_Calories'))

ggplot(fitbit_2019_Activity_melted, aes(x=Activity_Calories, y=value, col=variable)) +
geom_point()+
geom_smooth(method=lm, se=FALSE)+ 
theme_minimal() +
labs(colour = "Time in different Acrive status", title = "Total Activity Calories Vs Time spent in different activities",
     x=" Total Activity calories", y =" Activity Time in Min")


```

***

This graph show the trend between different type of active status such as Light, Fair and very. From the graph we can see that light activity such as running, walking etc. contributing more tom the total activity  calories however; based on very active trend we can see that calories contribution to total activity calories is very less.

### Trend between Active Calories vs Burned Calories
```{r}

fitbit_2019_Plot2 = fitbit_2019[,c(1,2,10)]
fitbit_2019_Plot2_melted = reshape2::melt(fitbit_2019_Plot2, id=c('Date'))

cal_vs_act = ggplot(fitbit_2019_Plot2_melted, aes(x=Date, y=value, col=variable)) +
             geom_line()+
             theme_minimal() +
             labs(title=" Trend Between Acivity Calories and Total Calories Burned", x ="Time", y ="Calories",colour = "Type")

grid.arrange(cal_vs_act, ncol=1)
```

***

This graph show the trend between calories burned Vs activity calories. Based on the graph we can see that both trend are the same. Also we can see that same spikes in both line during the same time. 

### Trend Between Distance and Floor throughout the year.
```{r}
fitbit_2019_Plot3 = fitbit_2019[,c(1,4,5)]
fitbit_2019_Plot3_melted = reshape2::melt(fitbit_2019_Plot3, id=c('Date'))

graph_5 = qplot(Date, value, data = fitbit_2019_Plot3_melted, geom = "line", group = variable) +
    facet_grid(variable ~ ., scale = "free_y") +
    theme_bw()
ggplotly()

```

***

This Interactive graph shows the daily distance and floor climbed trend throughout the year. From the graph we can see that maximum distance walked is around 10 mile and maximum floor climbed is 37 on 9/29/2019.

### Conclusion and Answers

**Question Answer**

1.	Trend between steps and Calories throughout the year 2019.
-	Overall trend is good. Highest steps recorded in April month as well as higest calories burned in April.

2.	 Which type of activity contribute more to total activity calories.
-	From the analysis we can see that Steps and floor contribute more to the Calories burned. 

3.	Trend between calories burned and physical activity.
-	Trend show that light active state contribute more to the total activity calories.

4.	Correlation between calories burned and activity calories 
-	Trend looks similar in both because activity calories get add to calories burned.

5.	Does the pattern for walking distance and floors climed remain same throughout the year?
-	Based on distance and number of floors climbed graph pattern is almost same throughout the year with a few spikes.  


**Conlcusion**

Based on this analysis, we can conclude highest  Avg number of steps recorded in April 6556. The highest Avg Calories burned is 2827 recorded in same month. Also we can see that Climbing floor and Walking are contributing more to Calories Burned. Also Light physical active state is also contributing more to the Activity calories then Fairly and Very activity.