Introduction

This dashboard is created as part of ANLY512: Data Visualization course final project.

The Quantified Self also known as lifelogging, is a movement to incorporate technology into data acquisition on aspects of a person’s daily life in terms of inputs, states, and performance, whether mental or physical. In short, quantified self is self-knowledge through self-tracking with technology.

Data Acquisition:

I have collected the data by wearing the Apple watch that I have recently purchased. The data logged is from November 1st, 2017 to February 16th, 2018. I wore the watch continuously so that I can provide qualitaty data into my well-being and don`t end up with inconsistent data. The data captured contains the date, day, steps per day, sleep timings, active calories burned, heart rate and Distance in miles.

I have downloaded the data from Apple watch using the QS Access App. It provided the data in .csv format. I have later converted into excle format.

Data Manipulation:

I am expecting a lot of differences with my daily activity based on the day. So I have created a new field with the type Day.

I have also manipulated the data by creating two other variables: sleep in hours heart level showing 0-5 with 0 being low heart rate and 5 being very high heart rate level

Questions:

Working on this project we will be looking into answering the following questions:

  1. Do I make 10K steps on each day? It has been long I particpated in 10K steps challenge withmy friends. Let see if I am still doing it.

  2. How many miles did I walk in each month?

  3. What is my average heart rate per weekday and does it match the average heart rate for a person my age?

  4. Is there a pattern in my active calories I burned?

  5. Do I sleep most of the days 6 hours per day? Do I sleep more time on weekends than weekdays?

Do I make 10K steps on each day? It has been long I particpated in 10K steps challenge withmy friends. Let see if I am still doing it.


It saddens me that I am not doing 10K steps per day and points to my sedentary life style. Setting up an alarm every hour to take few steps is going to help me out here. Let us see after few months whether I was able to acheive this target.

As I initially hypothesized that not being part of challenges with friends is making life sedentary. I will also start challenges with my friends to keep the target on.

We can also observe that during few weeks, I seem to have less number of steps. It is due to the one week per month I travel due to work and have less activity as I tend not to hit the Gym.

I used the bar plot per day to see if I am having more than 10K steps that can be compared on the Y-axis per day. we can observe that Ihad only 9 days where I was able to make the 10K steps.

How many miles did I walk in each month?


Weekday 1 - Sunday

Weekday 2 - Monday

Weekday 3 - Tuesday

Weekday 4 - Wednesday

Weekday 5 - Thursday

Weekday 6 - Friday

Weekday 7 - Saturday

I have walked 65 miles in November, 90 miles in December, 87 miles in January and 30 miles till Febrauary 16th. The more miles in December and Janauary is due to friends visting and touring places, and high motivation to go to gym.

In the second graph we cna observe that Sunday, Friday and Saturday, I walked less miles. This is mostly due to lazing around during the weekend at home. Weekdays with work, school and gym, I dont feel like going to places or to gym during the weekends. This can be clearly seen in decrease in miles in weekends.

What is my average heart rate per weekday and does it match the average heart rate for a person my age?


My average Heart rate is 129 bpm. The average heart rate for an adult is 60-100 bpm. As the data also contains the heart rate during my workout as well, it is higher. On Tuesday, Thursday and Friday, we can observe a higher heart rate compared to other weekdays as I generally work out on those days. It might also be that on Tuesdays, I have more meetings and presentations, that might be leading to higher heart rates. It is surprising thatmy hear rate is not in the 60-100 range, might be due to the stress levels I am having in the last few months.

Is there a pattern in my active calories I burned?


On Tuesday, Thursday and Friday, we see high distributions in active calories. I have been trying to work out on these days. But we can also see slightly lower distribution of active calories on other days. This might be due to cardio workouts on other days that I have tried to put it into my regime.

Looking at the monthly distribution, we can see that November I have consistent higher active calories in November and January. This can be explained by my higher activities and consistent workouts in November and January. The lower active calories in December might be due to lazing around and drinking Moscow mules during the holiday season.

Do I sleep most of the days 6 hours per day? Do I sleep more time on weekends than weekdays?


From the graph, we can see that I sleep most of the days 6 hours or more. On Fridays, I slept more than 6 hours on 8 more days in 14 fridays and we can also observe that I have not slept less than 5 hours on Fridays. There are few days where I slept for 0, 1 or 2 hours, which might be due to data issues.

Summary

By looking into the dashboard, I was able to validate few of my hypothesis about my activity and health in general. Though few of them came as a surprise and needs more action from my side. The Quantified Self provided good and actionable insights into my life.

---
title: "The Quantified Self Project"
output: 
  flexdashboard::flex_dashboard:
    storyboard: true
    social: menu
    source: embed
    orientation: columns
    vertical_layout: fill
---

```{r setup, include=FALSE}
library(flexdashboard)
library(knitr)
library(ggplot2)
library(tidyverse)
library(readxl)
library(dplyr)
library(xts)
library(zoo)
library(lubridate)
library(plotly)



daily = read_excel('C:\\Users\\Gautam Reddi\\Dropbox\\Harrisburg\\Term 2\\Data Visualization\\Project\\Health Data.xlsx')

daily$Sleephours <- as.integer(daily$Sleep/60)
daily$Weekday <- wday(parse_date_time(daily$Date, "%y/%m/%d"))
daily$Month <- month(parse_date_time(daily$Date, "%y/%m/%d"))
daily$heartratelevel = as.integer(daily$`Heart Rate`/40)

daily$Day = factor(daily$Day)
#daily$Month = factor(daily$Month)
daily$Sleephours = factor(daily$Sleephours)


```


###Introduction

This dashboard is created as part of ANLY512: Data Visualization course final project.

The Quantified Self also known as lifelogging, is a movement to incorporate technology into data acquisition on aspects of a person's daily life in terms of inputs, states, and performance, whether mental or physical. In short, quantified self is self-knowledge through self-tracking with technology.
 
 
 
Data Acquisition:

I have collected the data by wearing the Apple watch that I have recently purchased. The data logged is from November 1st, 2017 to February 16th, 2018. I wore the watch continuously so that I can provide qualitaty data into my well-being and don`t end up with inconsistent data. The data captured contains the date, day, steps per day, sleep timings, active calories burned, heart rate and Distance in miles.

I have downloaded the data from Apple watch using the QS Access App. It provided the data in .csv format. I have later converted into excle format.
  
 
 
Data Manipulation:

I am expecting a lot of differences with my daily activity based on the day. So I have created a new field with the type Day. 

I have also manipulated the data by creating two other variables:
sleep in hours 
heart level showing 0-5 with 0 being low heart rate and 5 being very high heart rate level
 
 
 
Questions:

Working on this project we will be looking into answering the following questions:

1. Do I make 10K steps on each day? It has been long I particpated in 10K steps challenge withmy friends. Let see if I am still doing it.

2. How many miles did I walk in each month?

3. What is my average heart rate per weekday and does it match the average heart rate for a person my age?

4. Is there a pattern in my active calories I burned?

5. Do I sleep most of the days 6 hours per day? Do I sleep more time on weekends than weekdays?




###Do I make 10K steps on each day? It has been long I particpated in 10K steps challenge withmy friends. Let see if I am still doing it. 

```{r}

daily$Steps <- round(daily$Steps)
x5 <- ggplot(daily, aes(Date, Steps)) 
x5 + geom_bar(stat = "identity", fill = "gold") + labs(y = "number of steps")


```
 
***
It saddens me that I am not doing 10K steps per day and points to my sedentary life style. Setting up an alarm every hour to take few steps is going to help me out here. Let us see after few months whether I was able to acheive this target.

As I initially hypothesized that not being part of challenges with friends is making life sedentary. I will also start challenges with my friends to keep the target on.

We can also observe that during few weeks, I seem to have less number of steps. It is due to the one week per month I travel due to work and have less activity as I tend not to hit the Gym. 

I used the bar plot per day to see if I am having more than 10K steps that can be compared on the Y-axis per day. we can observe that Ihad only 9 days where I was able to make the 10K steps.


###How many miles did I walk in each month?

```{r}
x2 <- ggplot(daily, aes(daily$Month, daily$Distance))
x2 + geom_bar(stat = "identity", fill = "green")


x2 <- ggplot(daily, aes(daily$Weekday, daily$Distance)) 
x2 + geom_bar(stat = "identity", fill = "Blue")


```

***
Weekday 1 -  Sunday

Weekday 2 -  Monday

Weekday 3 -  Tuesday

Weekday 4 -  Wednesday

Weekday 5 -  Thursday

Weekday 6 -  Friday

Weekday 7 -  Saturday


I have walked 65 miles in November, 90 miles in December, 87 miles in January and 30 miles till Febrauary 16th. The more miles in December and Janauary is due to friends visting and touring places, and high motivation to go to gym. 

In the second graph we cna observe that Sunday, Friday and Saturday, I walked less miles. This is mostly due to lazing around during the weekend at home. Weekdays with work, school and gym, I dont feel like going to places or to gym during the weekends. This can be clearly seen in decrease in miles in weekends.


###What is my average heart rate per weekday and does it match the average heart rate for a person my age?

```{r}

fill <- "gold1"
line <- "goldenrod2"

p1 <- ggplot(daily, aes(x = daily$Weekday, y=daily$`Heart Rate`)) + 
  geom_boxplot(aes(group = daily$Weekday), fill = fill, colour = line) +
  scale_x_discrete(limits=c("Sun","Mon","Tues","Wed","Thur","Fri","Sat")) +
  labs(title = "Heart rate per weekday", x = "Weekdays", y = "Heart rate") +
  theme_minimal()
p1
p2 <- ggplot(daily, aes(x = daily$Month, y=daily$`Heart Rate`)) + 
  geom_boxplot(aes(group = Month), fill = fill, colour = line) +
  scale_x_discrete(limits=c("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec")) +
  labs(title = "Heart rate per month", x = "Months", y = "Heart rate") +
  theme_minimal()
p2

```

***
My average Heart rate is 129 bpm. The average heart rate for an adult is 60-100 bpm. As the data also contains the heart rate during my workout as well, it is higher. On Tuesday, Thursday and Friday, we can observe a higher heart rate compared to other weekdays as I generally work out on those days. It might also be that on Tuesdays, I have more meetings and presentations, that might be leading to higher heart rates. It is surprising thatmy hear rate is not in the 60-100 range, might be due to the stress levels I am having in the last few months.

 


###Is there a pattern in my active calories I burned?

```{r}
p1 <- ggplot(daily, aes(daily$Weekday, daily$`Active Calories`))
p1 + geom_point(aes(colour = daily$Weekday)) + scale_colour_gradient(low = "red") + labs(y= "Active Calories per weekday") + labs(x= 'Weekdays')

p2 <- ggplot(daily, aes(daily$Month, daily$`Active Calories`))
p2 + geom_point(aes(colour = daily$Month)) + scale_colour_gradient(low = "red") + labs(y= "Active Calories per Month") + labs(x= 'Months')
```

***

On Tuesday, Thursday and Friday, we see high distributions in active calories. I have been trying to work out on these days. But we can also see slightly lower distribution of active calories on other days. This might be due to cardio workouts on other days that I have tried to put it into my regime. 

Looking at the monthly distribution, we can see that November I have consistent higher active calories in November and January. This can be explained by my higher activities and consistent workouts in November and January. The lower active calories in December might be due to lazing around and drinking Moscow mules during the holiday season. 

###Do I sleep most of the days 6 hours per day? Do I sleep more time on weekends than weekdays?

```{r}

p <- ggplot(data = daily, aes(x = Sleephours, fill = Day)) +
  geom_bar(position = "dodge")
ggplotly(p)

```

***
From the graph, we can see that I sleep most of the days 6 hours or more. On Fridays, I slept more than 6 hours on 8 more days in 14 fridays and we can also observe that I have not slept less than 5 hours on Fridays. There are few days where I slept for 0, 1 or 2 hours, which might be due to data issues.




###Summary

By looking into the dashboard, I was able to validate few of my hypothesis about my activity and health in general. Though few of them came as a surprise and needs more action from my side. The Quantified Self provided good and actionable insights into my life.