Project Description

Row

Project Objective

The Project Objective is as follows: 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 an written summary of your data collection, analysis and visualization methods, including the 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.

Row

Research Summary

In this project, I decided to learn more about my daily activities and how they affect my own life. I used the data collected for the last month on such variables of interest as sleeping time, in minutes, calories intake, and time spent on social media (Instagram), in minutes. The data on the amount of time I spent in Instagram was retrieved from this application - Instagram provides a report about time spent online. Next, my sleeping time was recorded from the fitness bracelet I have. Finally, I used MyFitnessPal, a popular calorie counter, to track the volume of calories I consume every day. My aim was to examine the trends I see in these three factors over the last month, and understand how time spent on social media and amount of food I eat may affect my sleeping time.

The analysis showed that I usually spend more time online at weekends, and sleep more on weekends too. However, the scatter plot created to visualize the relationship between time spent on social media and time spent on sleeping demonstrated a clear negative trend. It seems that if I spend more time on social media, then I sleep less. This result is very important, as it may indicate the negative effect of social media use (and the duration of use) on sleeping.

Similarly, there was a negative association between the calorie intake and sleeping. It seems that if I eat more, then my sleeping time is shorter. Numerous nutritionists suggest no eating before going to bed, and recommend to track our own diet so to avoid overeating. As seen from the analysis, more eating is associated with lower sleeping times, which may negatively affect health.

Row

The List of Questions

The following five questions were selected for the exploration in this project:

  1. How much time did I spent on social media during the last month?

  2. How much time did I sleep daily during the last month?

  3. Is there an association between daily sleep and time spent on social media?

  4. How much calories did I intake during the last month?

  5. Is there a relationship between calories intake and the amount of time I sleep during the last month?

Social Media

Row

Figure 1. Time Spent on Social Media

Sleeping

Row

Figure 2. Time Spent on Sleeping

Sleep and Social Media

Row

Figure 3. Relationship between Sleeping Time and Social Media Use

Calories

Row

Figure 4. Distribution of Calories Intake

Calories and Sleep

Row

Figure 5. Relationship between Calories Intake and Sleeping Time

---
title: "Final Project"
output: 
  flexdashboard::flex_dashboard:
    orientation: columns
    vertical_layout: fill
    source_code: embed
  
---

```{r setup, include=FALSE}
library(flexdashboard)
library(dplyr)
library(ggplot2)
library(tidyverse)
library(knitr)
```


Project Description
===========================================

Row {}
-----------------------------------------------------------------------

### Project Objective
The Project Objective is as follows:
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 an written summary of your data collection, analysis and visualization methods, including the 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. 


Row {}
-----------------------------------------------------------------------

### Research Summary

In this project, I decided to learn more about my daily activities and how they affect my own life. I used the data collected for the last month on such variables of interest as sleeping time, in minutes, calories intake, and time spent on social media (Instagram), in minutes. The data on the amount of time I spent in Instagram was retrieved from this application - Instagram provides a report about time spent online. Next, my sleeping time was recorded from the fitness bracelet I have. Finally, I used MyFitnessPal, a popular calorie counter, to track the volume of calories I consume every day. My aim was to examine the trends I see in these three factors over the last month, and understand how time spent on social media and amount of food I eat may affect my sleeping time.

The analysis showed that I usually spend more time online at weekends, and sleep more on weekends too. However, the scatter plot created to visualize the relationship between time spent on social media and time spent on sleeping demonstrated a clear negative trend. It seems that if I spend more time on social media, then I sleep less. This result is very important, as it may indicate the negative effect of social media use (and the duration of use) on sleeping.

Similarly, there was a negative association between the calorie intake and sleeping. It seems that if I eat more, then my sleeping time is shorter. Numerous nutritionists suggest no eating before going to bed, and recommend to track our own diet so to avoid overeating. As seen from the analysis, more eating is associated with lower sleeping times, which may negatively affect health. 

Row {}
-----------------------------------------------------------------------

### The List of Questions
The following five questions were selected for the exploration in this project:

1) How much time did I spent on social media during the last month?

2) How much time did I sleep daily during the last month?

3) Is there an association between daily sleep and time spent on social media?

4) How much calories did I intake during the last month?

5) Is there a relationship between calories intake and the amount of time I sleep during the last month?

Social Media
===========================================

Row {}
-----------------------------------------------------------------------

### Figure 1. Time Spent on Social Media

```{r, echo=FALSE}
mydata = read.csv(file="mydata.csv")
ggplot(data=mydata, aes(x=Date, y=SocialMedia, fill = "Time Spent")) + 
  geom_bar(stat='identity', color="black", alpha=0.8) +
  scale_x_discrete(limits=mydata$Date) +
  scale_fill_manual(values=c("#F8766D")) +
  theme_classic() +
  theme(axis.text.x=element_text(angle=90, vjust = 0.5)) +
  labs(title="Time Spent on Social Media Over the Last Month", 
       x="Date", y="Time Spent on Social Media") +
  guides(fill=FALSE)
```

Sleeping
===================================== 
Row {}
-------------------------------------
### Figure 2. Time Spent on Sleeping
```{r,echo = FALSE}

mydata$Date<-as.Date(as.character(mydata$Date), format = "%m/%d/%Y")
ggplot(mydata, aes(x=Date, y=Sleep)) +
  geom_line(color="#0072B2", size=1.5) + 
  labs(title="My Sleeping Time Over the Last Month", x="Date", y="Sleeping Time") +
  theme_minimal() + 
  theme(plot.title = element_text(hjust = 0.5, size=20), 
        axis.title = element_text(size=15), 
        axis.text = element_text(size=12), 
        panel.grid.major = element_blank(),
        panel.grid.minor = element_blank(),
        panel.border = element_blank(),
        legend.position = "none")
```

Sleep and Social Media
=====================================
Row {}
-------------------------------------
### Figure 3. Relationship between Sleeping Time and Social Media Use
```{r, echo=FALSE}
ggplot(mydata, aes(x=SocialMedia, y=Sleep)) +
  geom_point(color="red", size=3, alpha=0.7) +
  labs(title="Sleeping Time vs Time Spent on Social Media", x="Time Spent on Social Media", y="Sleeping Time") +
  theme_bw() +
  theme(plot.title = element_text(hjust = 0.5, size = 18, face = "bold"),
        axis.text = element_text(size = 12),
        axis.title = element_text(size = 14, face = "bold"),
        panel.grid.major = element_blank(),
        panel.grid.minor = element_blank(),
        legend.position = "none")
```

Calories
===================================== 
Row {}
-------------------------------------
### Figure 4. Distribution of Calories Intake 
```{r, echo=FALSE}
ggplot(mydata, aes(x=Calories)) +
  geom_histogram(color="white", fill="blue", binwidth=100, alpha=0.8) +
  labs(title="Distribution of Calories Intake", x="Calories", y="Count") +
  theme_minimal()
```

Calories and Sleep
===================================== 
Row {}
-------------------------------------
### Figure 5. Relationship between Calories Intake and Sleeping Time
```{r, echo=FALSE}
ggplot(mydata, aes(x=Calories, y=Sleep)) +
  geom_point(color="blue", alpha=0.5, size=3) +
  labs(title="Relationship Between Calories Intake and Sleeping Time", x="Calories", y="Sleeping Time") +
  theme_classic() +
  theme(plot.title = element_text(face="bold", size=14, hjust=0.5),
        axis.title = element_text(face="bold", size=12),
        axis.text = element_text(size=12),
        panel.background = element_rect(fill="#f5f5f5", color=NA),
        panel.grid.major = element_line(color="white", size=0.2),
        panel.grid.minor = element_line(color="white", size=0.1),
        legend.position = "none")
```