In this project, for one week, I logged my daily activities into Google Calender.Then I imported that data into Rstudio and came up with questions about my routine that I answered by performing data transformation.

Research Questions

Questions about my routine that I came up with are
1. Which activity takes up most of my time?
2. Do I give enough time to extra curricular activities/hobbies?
3. How much time do I spend eating?

Loading Data

Loading tidyverse and ical packages

library(tidyverse)
## -- Attaching packages --------------------------------------- tidyverse 1.3.1 --
## v ggplot2 3.3.3     v purrr   0.3.4
## v tibble  3.1.1     v dplyr   1.0.6
## v tidyr   1.1.3     v stringr 1.4.0
## v readr   1.4.0     v forcats 0.5.1
## -- Conflicts ------------------------------------------ tidyverse_conflicts() --
## x dplyr::filter() masks stats::filter()
## x dplyr::lag()    masks stats::lag()
library(ical)
library(here)
## here() starts at C:/Users/Owner/Desktop/Sem1/DAB501
library(dplyr)


Load ics file using ical package

mycal<- 
  here::here("data","DAB501_cal.ics") %>% 
  ical_parse_df() %>% 
  as_tibble()

Data Transformation

Adding minutes, hours and seconds columns to the dataset.

mycal <- mycal %>%
  mutate(
    minutes = (end - start) %>% as.numeric() ,
    seconds= minutes * 60,
    hours= minutes / 60
    
  )


Creating a new column time_unit. This column will contain the date without the time.

mycal <- mycal %>% 
  mutate(
    time_unit = lubridate::floor_date(start, unit = "day")
  )

Visualization 1

mycal<-mycal %>% group_by(time_unit,summary)%>% 
  dplyr::summarize(
  total_min=sum(minutes),
  total_hours=total_min/60
  )
## `summarise()` has grouped output by 'time_unit'. You can override using the `.groups` argument.
 ggplot(mycal,aes(time_unit,total_hours,color=summary))+
  geom_line()+
  geom_point()+
  labs(title="Total hours by activity", x="Date",y="Total Hours")+
  theme_minimal()


Answers to Research Questions

Visualization 1 answers the first and the second question. The activities I spend most of my time on are sleep,work and study. And since extra curriculars/hobbies are on the lower end of y axis, I would say I donโ€™t spend enough time on extra curriculars.
And for the third question we can do some more data transformation.

mycal %>%  group_by(summary) %>%
  summarize(eat_time=sum(total_hours)) %>% 
  filter(summary=="Breakfast" | summary=="Lunch" | summary=="Dinner")
## # A tibble: 3 x 2
##   summary   eat_time
##   <chr>        <dbl>
## 1 Breakfast        7
## 2 Dinner           4
## 3 Lunch            5


And now we have the total hours spent on meals grouped by the type over the course of one week.

The End