Viz

Column

Chart A1

Chart A2

Chart A3

Column

Chart B1

Chart B2

Chart B3

Column

Chart C1

Chart C2

Chart D3

Column

Chart D1

Chart D2

Chart D3

Does Going Into Office Make Me Healthy?

Column

Data

Monitoring and tracking human-related data, such as biological, physical, behavioral, or environmental data, is the aim of quantified self-tracking (Swan, 2009). Quantified self-tracking typically coexists with the ideas of “self-knowledge through numbers” (Ruckenstein, 2015; Schüll, 2016; Swan, 2012) and “self-optimization” (Choe et al., 2014:1147;).

There could be an unlimited amount of things to measure, but QS is concerned with using QS data to reveal important insights that can be used to alter and enhance human behavior. As a result, there is a proactive stance toward obtaining information and acting on it.

As part of this quantified self (QS) project, I set out to track, monitor and analyze my personal metrics. Gathering good quality data is essential for any data analysis project.

Data gathering:

  • step_count (count) : steps walked in a day [source: Samsung Health app]
  • active_mins (in mins): duration stayed active in a day [source: Samsung Health app]
  • food_rating (1-5) : the quality of food eaten throught a day [source: self noted]
  • youtube_watched (in mins) : time spent watching YouTube in a day [source: YouTube app]
  • in_office (yes/no) : whether I went into the office on given day [source: self noted]

The data was gathered over a span of 7 weeks.

Column

Methods

I wanted to see how different aspects of my personal habits change through a span of several weeks. As I kept gathering data, I started noticing patterns. I wanted to analyze these patterns from a birds-eye view and also drill-down in to details and get aggregated report.

The line charts:

  • Chart A1 Step Count: This chart gives a bird-eye view of my step count throughout the span of seven weeks. The average step count for this duration (faceted by the days when I went into office, and not) is also marked on this plot. Higher is better.

  • Chart A2 Food Quality Rating: This chart gives a bird-eye view of my daily food intake quality throughout the span of seven weeks. The average rating for this duration (faceted by the days when I went into office, and not) is also marked on this plot. Higher is better.

  • Chart A3 Screen Time - Youtube: This chart gives a bird-eye view of my time (in mins) spent watching YouTube throughout the span of seven weeks. The average watch time for this duration (faceted by the days when I went into office, and not) is also marked on this plot. Lower is better.

The bar charts:

  • Chart B1 Average Step Count by Weekday: This chart provides a summary of my step count throughout the days of the week. The strength of red hue is proportional to my step count. Strong red hue is better.

  • Chart B2 Average Food Rating by Weekday: This chart provides a summary of my daily food intake the days of the week. The strength of red hue is proportional to food quality rating. Strong red hue is better.

  • Chart B3 Average Youtube Watched by Weekday: This chart provides a summary of my time (in mins) spent watching YouTube throughout the days of the week. The strength of red hue is proportional to food quality rating. Weak red hue is better.

The box-plots:

  • Chart C1 Average Step Count: This chart summarizes my average step count grouped by the days I go into office and do not go into office. Higher is better.

  • Chart C2 Average Food Rating: This chart summarizes my average food rating grouped by the days I go into office and do not go into office. Higher is better.

  • Chart C3 Average YouTube Watched: This chart summarizes my average time spent watching YouTube grouped by the days I go into office and do not go into office. Lower is better.

The pie charts:

  • Chart D1 Average Steps - Overall: This chart provides a good overview with percentage of my total step count grouped by the days I go into office and do not go into office. Higher is better.

  • Chart D2 Average Food Rating - Overall: This chart provides a good overview with percentage of my total food rating grouped by the days I go into office and do not go into office. Higher is better.

  • Chart D3 Average YouTube Watched - Overall: This chart provides a good overview with percentage of my total time spent watching YouTube grouped by the days I go into office and do not go into office. Lower is better.

All charts have been produced using ggplot2 and plotly charting libraries in R.

Column

Analysis

I have been working from home since the beginning of COVID-19 pandemic (Feb, 2020). Although recently (starting Sept 2022) my company announced Return to Office (RTO), where in I have to go to office to work twice a week. I started going into office every Wednesday and Thursday. I wanted to see how much this has impact on my daily routine.

The main question I wanted to answer with this - does going into office make me healthy?

Before diving into it, I wanted to answer the following -

  • how does going into office impact my daily step count?
    It turns out that I log more steps the days I go into office. This is due to the long commute that takes about an hour by car, metro and on foot for me to get to office.

  • how does going into office impact my food intake quality?
    It turns out the days I go into office, my food quality rating is higher compared to the days I stay at home. I guess I follow a good eating routine when I’m at the office, vs when I’m home. I plan and prepare my meals much better the days I go to work.

  • how does going into office impact my screen time?
    It turns out I spend way less time watching YouTube the days I go into office. That is a good thing, as I would like to reduce my screen time.

  • what days of the week am I being more healthy?
    Wednesdays and Thursdays seem to be the days I record highest step count, highest food quality rating and lowest screen time in terms of YouTube watched.

  • how much is the impact?
    The days I go into the office, my average step count is twice as compared to the days I don’t to work in the office. So is true for my food quality rating. It turns out my YouTube watching time reduces by 3 times the days I go into work!

So, after answering all the above questions it does turn out that going into office is healthier for me!

---
title: "<b>The Quantified Self<b> - A Personal Report"
output: 
  flexdashboard::flex_dashboard:
    #orientation: columns
    #vertical_layout: fill
    theme:
      version: 4
      bootswatch: lux
    orientation: columns
    vertical_layout: fill
    source_code: embed
editor_options: 
  chunk_output_type: console
---

```{r}
library(readxl)
library(ggplot2)
library(hrbrthemes)
library(dplyr)
library(plotly)
```

```{r}
#Import data
data.office <- read_excel("data/office.xlsx")

# Formatting date
data.office$date.formatted <- as.Date(data.office$date, format = "%y-%m-%d")

# day as factor
data.office$day <- factor(data.office$day, levels = c('Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'))

# inOffice as Yes or No
data.office$inOfficeWord <- factor(data.office$inOffice, levels = c(0,1), labels = c("No", "Yes"))
```

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

# Viz

## Column {data-width="400"}

### Chart A1

```{r}
meanSteps <- 
  data.office %>%
  group_by(inOffice) %>%
  #filter(inOffice == 0) %>%
  dplyr::summarise(Mean = mean(stepsPhone))
```

```{r}
a1 <- ggplot(data.office, aes(x=date.formatted, y=stepsPhone)) +
  geom_line(color="steelblue") +
  geom_point() +
  geom_hline(aes(yintercept = (meanSteps %>% filter(inOffice == 1) %>% pull(Mean)), color="Yes"),
             linetype=2, size=0.5) +
  geom_hline(aes(yintercept = (meanSteps %>% filter(inOffice == 0) %>% pull(Mean)), color="No"),
             linetype=2, size=0.5) +
  scale_colour_manual(values = c("orange", "red")) +
  scale_x_date(date_breaks = "1 week", date_labels = "%d-%b") +
  theme_ipsum() +
  theme(panel.grid.minor = element_blank(),
        legend.position='bottom') +
  labs(title="Step Count",
        x ="Date", y = "Step Count",
       color = "Went to office?")
a1 <- ggplotly(a1)
a1
```

### Chart A2

```{r}
meanFoodRating <- 
  data.office %>%
  group_by(inOffice) %>%
  #filter(inOffice == 0) %>%
  dplyr::summarise(Mean = mean(foodRating))
```

```{r}
a2 <- ggplot(data.office, aes(x=date.formatted, y=foodRating)) +
  geom_line(color="steelblue") +
  geom_point() +
  geom_hline(aes(yintercept = (meanFoodRating %>% filter(inOffice == 1) %>% pull(Mean)), color="Yes"),
             linetype=2, size=0.5) +
  geom_hline(aes(yintercept = (meanFoodRating %>% filter(inOffice == 0) %>% pull(Mean)), color="No"),
             linetype=2, size=0.5) +
  scale_colour_manual(values = c("orange", "red")) +
  scale_x_date(date_breaks = "1 week", date_labels = "%d-%b") +
  theme_ipsum() +
  theme(panel.grid.minor = element_blank()) +
  labs(title="Food Quality Rating",
        x ="Date", y = "Food Rating",
       color = "Went to office?")
a2 <- ggplotly(a2)
a2
```

### Chart A3

```{r}
meanYoutubeWatched <- 
  data.office %>%
  group_by(inOffice) %>%
  #filter(inOffice == 0) %>%
  dplyr::summarise(Mean = mean(youtubeWatchedMins))
```

```{r}
a3 <- ggplot(data.office, aes(x=date.formatted, y=youtubeWatchedMins)) +
  geom_line(color="steelblue") +
  geom_point() +
  geom_hline(aes(yintercept = (meanYoutubeWatched %>% filter(inOffice == 1) %>% pull(Mean)), color="Yes"),
             linetype=2, size=0.5) +
  geom_hline(aes(yintercept = (meanYoutubeWatched %>% filter(inOffice == 0) %>% pull(Mean)), color="No"),
             linetype=2, size=0.5) +
  scale_colour_manual(values = c("orange", "red")) +
  scale_x_date(date_breaks = "1 week", date_labels = "%d-%b") +
  theme_ipsum() +
  theme(panel.grid.minor = element_blank()) +
  labs(title="Screen Time - Youtube",
        x ="Date", y = "Youtube Watched (in mins)",
       color = "Went to office?")
a3 <- ggplotly(a3)
a3
```

## Column {data-width="200"}

### Chart B1

```{r}
stepAggrByDay <- aggregate(stepsPhone ~ day, data.office, mean)
```

```{r}
b1 <- ggplot(stepAggrByDay, aes(x=day, y=stepsPhone, fill=stepsPhone)) +
  geom_bar(stat = 'identity') +
  scale_fill_gradient2(mid = "yellow", high='red', space='Lab') +
  theme_ipsum() +
  theme(
    panel.grid.major.x = element_blank(),
    panel.grid.minor.x = element_blank()
  ) +
  labs(title="Average Step Count by Weekday",
        x ="Day of the week", y = "Step count (Average)", fill="Steps")
b1 <- ggplotly(b1)
b1
```

### Chart B2

```{r}
foodRatingAggrByDay <- aggregate(foodRating ~ day, data.office, mean)
```

```{r}
b2 <- ggplot(foodRatingAggrByDay, aes(x=day, y=foodRating, fill=foodRating)) +
  geom_bar(stat = 'identity') +
  scale_fill_gradient2(mid = "yellow", high='red', space='Lab') +
  theme_ipsum() +
  theme(
    panel.grid.major.x = element_blank(),
    panel.grid.minor.x = element_blank()
  ) +
  labs(title="Average Food Rating by Weekday",
        x ="Day of the week", y = "Food Rating (Average)", fill="Rating")
b2 <- ggplotly(b2)
b2
```

### Chart B3

```{r}
youtubeWatchedAggrByDay <- aggregate(youtubeWatchedMins ~ day, data.office, mean)
```

```{r}
b3 <- ggplot(youtubeWatchedAggrByDay, aes(x=day, y=youtubeWatchedMins, fill=youtubeWatchedMins)) +
  geom_bar(stat = 'identity') +
  scale_fill_gradient2(mid = "yellow", high='red', space='Lab') +
  theme_ipsum() +
  theme(
    panel.grid.major.x = element_blank(),
    panel.grid.minor.x = element_blank()
  ) +
  labs(title="Average Youtube Watched by Weekday",
        x ="Day of the week", y = "Youtube Watchtime ((Average) in mins)", fill="Watchtime (mins)")
b3 <- ggplotly(b3)
b3
```

## Column {data-width="200"}

### Chart C1

```{r}
c1 <- ggplot(data = data.office, aes(x = inOfficeWord, y = stepsPhone,fill = inOfficeWord)) +
  geom_boxplot() +
  scale_fill_manual(values = c("orange", "red")) +
  theme_ipsum() +
  theme(
    panel.grid.major.x = element_blank(),
    panel.grid.minor.x = element_blank(),
    axis.text.x = element_blank(),
    axis.ticks.x = element_blank()
  ) +
  labs(title="Average Step Count",
       x = "", y = "Step count (Average)", fill="Went to office?")
c1 <- ggplotly(c1)
c1
```

### Chart C2

```{r}
c2 <- ggplot(data = data.office, aes(x = inOfficeWord, y = foodRating,fill = inOfficeWord)) +
  geom_boxplot() +
  scale_fill_manual(values = c("orange", "red")) +
  theme_ipsum() +
  theme(
    panel.grid.major.x = element_blank(),
    panel.grid.minor.x = element_blank(),
    axis.text.x = element_blank(),
    axis.ticks.x = element_blank()
  ) +
  labs(title="Average Food Rating",
       x = "", y = "Food Rating (Average)", fill="Went to office?")
c2 <- ggplotly(c2)
c2
```

### Chart D3

```{r}
c3 <- ggplot(data = data.office, aes(x = inOfficeWord, y = youtubeWatchedMins,fill = inOfficeWord)) +
  geom_boxplot() +
  scale_fill_manual(values = c("orange", "red")) +
  theme_ipsum() +
  theme(
    panel.grid.major.x = element_blank(),
    panel.grid.minor.x = element_blank(),
    axis.text.x = element_blank(),
    axis.ticks.x = element_blank()
  ) +
  labs(title="Average Youtube Watchtime",
       x = "", y = "Youtube Watchtime ((Average) in mins)", fill="Went to office?")
c3 <- ggplotly(c3)
c3
```

## Column {data-width="200"}

### Chart D1

```{r}
m <- list(
  l = 50,
  r = 50,
  b = 100,
  t = 50,
  pad = 2
)
```

```{r}
stepAggrByOffice <- aggregate(stepsPhone ~ inOfficeWord, data.office, mean)
```

```{r}
d1 <- plot_ly(stepAggrByOffice, labels = ~inOfficeWord, values = ~stepsPhone, type = 'pie', marker = list(colors = c('#feb24c', '#f03b20'), line = list(color = '#FFFFFF', width = 1)))
d1 <- d1 %>% 
  layout(title = list(text = '<b>Average Steps - Overall<b>', font=list(family="Arial Narrow", size=20, color = 'black'), x=0.45, y=0.95),
         legend=list(title=list(text=' Went to office? '), x=1.1, y=0.5),
         font=list(family="Arial Narrow", size=12),
         xaxis = list(showgrid = FALSE, zeroline = FALSE, showticklabels = FALSE),
         yaxis = list(showgrid = FALSE, zeroline = FALSE, showticklabels = FALSE),
         autosize = F, width = 450, height = 450, margin = m)
d1
```

### Chart D2

```{r}
foodRatingAggrByOffice <- aggregate(foodRating ~ inOfficeWord, data.office, mean)
```

```{r}
d2 <- plot_ly(foodRatingAggrByOffice, labels = ~inOfficeWord, values = ~foodRating, type = 'pie', marker = list(colors = c('#feb24c', '#f03b20'), line = list(color = '#FFFFFF', width = 1)))
d2 <- d2 %>% 
  layout(title = list(text = '<b>Average Food Rating - Overall<b>', font=list(family="Arial Narrow", size=20, color = 'black'), x=0.45, y=0.95),
         legend=list(title=list(text=' Went to office? '), x=1.1, y=0.5),
         font=list(family="Arial Narrow", size=12),
         xaxis = list(showgrid = FALSE, zeroline = FALSE, showticklabels = FALSE),
         yaxis = list(showgrid = FALSE, zeroline = FALSE, showticklabels = FALSE),
         autosize = F, width = 450, height = 450, margin = m)
d2
```

### Chart D3

```{r}
youtubeWatchedAggrByOffice <- aggregate(youtubeWatchedMins ~ inOfficeWord, data.office, mean)
```

```{r}
d3 <- plot_ly(youtubeWatchedAggrByOffice, labels = ~inOfficeWord, values = ~youtubeWatchedMins, type = 'pie', marker = list(colors = c('#feb24c', '#f03b20'), line = list(color = '#FFFFFF', width = 1)))
d3 <- d3 %>% 
  layout(title = list(text = '<b>Average Youtube Watched - Overall<b>', font=list(family="Arial Narrow", size=20, color = 'black'), x=0.45, y=0.95),
         legend=list(title=list(text='Went to office?'), x=1.1, y=0.5),
         font=list(family="Arial Narrow", size=12),
         xaxis = list(showgrid = FALSE, zeroline = FALSE, showticklabels = FALSE),
         yaxis = list(showgrid = FALSE, zeroline = FALSE, showticklabels = FALSE),
         autosize = F, width = 450, height = 450, margin = m)
d3
```

# Does Going Into Office Make Me Healthy?

## Column

### Data

Monitoring and tracking human-related data, such as biological, physical, behavioral, or environmental data, is the aim of quantified self-tracking (Swan, 2009). Quantified self-tracking typically coexists with the ideas of "self-knowledge through numbers" (Ruckenstein, 2015; Schüll, 2016; Swan, 2012) and "self-optimization" (Choe et al., 2014:1147;).

There could be an unlimited amount of things to measure, but QS is concerned with using QS data to reveal important insights that can be used to alter and enhance human behavior. As a result, there is a proactive stance toward obtaining information and acting on it.

As part of this quantified self (QS) project, I set out to track, monitor and analyze my personal metrics. Gathering good quality data is essential for any data analysis project.

**Data gathering:**

-   `step_count` (count) : steps walked in a day [source: Samsung Health app]
-   `active_mins` (in mins): duration stayed active in a day [source: Samsung Health app]
-   `food_rating` (1-5) : the quality of food eaten throught a day [source: self noted]
-   `youtube_watched` (in mins) : time spent watching YouTube in a day [source: YouTube app]
-   `in_office` (yes/no) : whether I went into the office on given day [source: self noted]

The data was gathered over a span of 7 weeks.

## Column

### Methods

I wanted to see how different aspects of my personal habits change through a span of several weeks. As I kept gathering data, I started noticing patterns. I wanted to analyze these patterns from a birds-eye view and also drill-down in to details and get aggregated report.

**The line charts:**

-   `Chart A1` Step Count: This chart gives a bird-eye view of my step count throughout the span of seven weeks. The average step count for this duration (faceted by the days when I went into office, and not) is also marked on this plot. *Higher is better.*

-   `Chart A2` Food Quality Rating: This chart gives a bird-eye view of my daily food intake quality throughout the span of seven weeks. The average rating for this duration (faceted by the days when I went into office, and not) is also marked on this plot. *Higher is better.*

-   `Chart A3` Screen Time - Youtube: This chart gives a bird-eye view of my time (in mins) spent watching YouTube throughout the span of seven weeks. The average watch time for this duration (faceted by the days when I went into office, and not) is also marked on this plot. *Lower is better.*

**The bar charts:**

-   `Chart B1` Average Step Count by Weekday: This chart provides a summary of my step count throughout the days of the week. The strength of red hue is proportional to my step count. *Strong red hue is better.*

-   `Chart B2` Average Food Rating by Weekday: This chart provides a summary of my daily food intake the days of the week. The strength of red hue is proportional to food quality rating. *Strong red hue is better.*

-   `Chart B3` Average Youtube Watched by Weekday: This chart provides a summary of my time (in mins) spent watching YouTube throughout the days of the week. The strength of red hue is proportional to food quality rating. *Weak red hue is better.*

**The box-plots:**

-   `Chart C1` Average Step Count: This chart summarizes my average step count grouped by the days I go into office and do not go into office. *Higher is better.*

-   `Chart C2` Average Food Rating: This chart summarizes my average food rating grouped by the days I go into office and do not go into office. *Higher is better.*

-   `Chart C3` Average YouTube Watched: This chart summarizes my average time spent watching YouTube grouped by the days I go into office and do not go into office. *Lower is better.*

**The pie charts:**

-   `Chart D1` Average Steps - Overall: This chart provides a good overview with percentage of my total step count grouped by the days I go into office and do not go into office. *Higher is better.*

-   `Chart D2` Average Food Rating - Overall: This chart provides a good overview with percentage of my total food rating grouped by the days I go into office and do not go into office. *Higher is better.*

-   `Chart D3` Average YouTube Watched - Overall: This chart provides a good overview with percentage of my total time spent watching YouTube grouped by the days I go into office and do not go into office. *Lower is better.*

All charts have been produced using `ggplot2` and `plotly` charting libraries in `R`.

## Column

### Analysis

I have been working from home since the beginning of COVID-19 pandemic (Feb, 2020). Although recently (starting Sept 2022) my company announced Return to Office (RTO), where in I have to go to office to work twice a week. I started going into office every Wednesday and Thursday. I wanted to see how much this has impact on my daily routine.

The main question I wanted to answer with this - does going into office make me healthy?

Before diving into it, I wanted to answer the following -

-   how does going into office impact my daily step count?\
    It turns out that I log more steps the days I go into office. This is due to the long commute that takes about an hour by car, metro and on foot for me to get to office.

-   how does going into office impact my food intake quality?\
    It turns out the days I go into office, my food quality rating is higher compared to the days I stay at home. I guess I follow a good eating routine when I'm at the office, vs when I'm home. I plan and prepare my meals much better the days I go to work.

-   how does going into office impact my screen time?\
    It turns out I spend way less time watching YouTube the days I go into office. That is a good thing, as I would like to reduce my screen time.

-   what days of the week am I being more healthy?\
    Wednesdays and Thursdays seem to be the days I record highest step count, highest food quality rating and lowest screen time in terms of YouTube watched.

-   how much is the impact?\
    The days I go into the office, my average step count is twice as compared to the days I don't to work in the office. So is true for my food quality rating. It turns out my YouTube watching time reduces by 3 times the days I go into work!

So, after answering all the above questions it does turn out that going into office is healthier for me!