This repository has been archived by the owner on May 26, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
README.Rmd
78 lines (54 loc) · 4.04 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
---
title: "Daily Satisfaction"
author: "Adam Kirosingh"
date: "10/29/2018"
output:
md_document:
variant: markdown_github
---
I've been using Everedoo (https://www.eurugo.com/) to ask me two daily questions each day since September 1, 2018. "How was your day?" and "How much sleep did you get?"
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
```{r Setup, include=FALSE}
pkgs_needed = c("tidyverse","readr", "kableExtra","plotly", "viridis")
source("http://bioconductor.org/biocLite.R")
biocLite(setdiff(pkgs_needed, installed.packages()), suppressUpdates = TRUE)
library(tidyverse)
library(readr)
library(kableExtra)
library(plotly)
library(viridis)
```
Initially I wanted to understand how my satisfaction with the day has fluctuated throughout the month. Since I was recording time spent sleeping, I expected them both to correlate but the correlation is kind of weak.
Unexpectedly, I think the fluctuation can be explained by the day before. I think the measure of satisfaction is always going to be relative because there isn't really a way to normalize. For example: if I spent a week with a series of bad days, the next okay day would seem really great in comparison. I don't know if there is a way to make these measurements more comparable over time. But that's something to look into.
```{r, warning=FALSE,message=FALSE, echo = FALSE}
Satisfaction <- read_delim("export/export_86745472-27C3-4591-BB63-AF5EC999E79B_20181106085105.csv",
";", escape_double = FALSE, trim_ws = TRUE,
skip = 2)
Sleep <- read_delim("export/export_FE76EE25-8480-43A6-9D85-6D102831F27A_20181106085105.csv",
";", escape_double = FALSE, trim_ws = TRUE,
skip = 2)
Combined <- merge(Sleep, Satisfaction, by = "Date")
names(Combined) <- c("Date", "Sleep.Entry", "Sleep", "Satisfaction.Entry", "Satisfaction")
Combined$betterDate <- as.Date(Combined$Date, "%m/%d/%y")
Combined$Date <- as.Date(ifelse(Combined$betterDate > Sys.Date(),
format(Combined$betterDate, "19%y-%m-%d"),
format(Combined$betterDate)))
ggplot(Combined, aes(x= Date, y = Satisfaction, color = as.integer(Date))) + geom_line(,size = 3)+ geom_point()+ ylim(0,10)+theme_classic() + scale_color_viridis_c() + theme(legend.position = "none",text = element_text(size=20)) + labs(y="Satisfaction on a 1-10 Scale", title = "How was your day? (5:00pm)")
ggplot(Combined, aes(x= Date, y = Sleep, color = as.integer(Date))) + geom_line(size = 3)+ geom_point()+ ylim(0,10)+theme_classic() + scale_color_viridis_c() + theme(legend.position = "none",text = element_text(size=20)) + labs(y="Approximate Sleep in Hours", title = "How much sleep did you get?")
Gathered <- Combined %>%
select(Date,Satisfaction,Sleep) %>%
gather(key = Type,value = Amount,-Date)
#ggplot(Gathered, aes(x=Date, y= Amount, color = Type)) + geom_line() +theme_classic() + ylim(0,10) + theme(text = element_text(size=20), legend.position = "none")
ggplot(Combined, aes(x= Sleep, y = Satisfaction)) + geom_jitter(aes(color = as.integer(Date)))+ xlim(0,10) + ylim(0,10) + geom_smooth(method='lm',formula=y~x,se = FALSE, color = "lightgrey")+theme_classic() + theme(legend.position = "none",text = element_text(size=20))+ scale_color_viridis_c()
```
Next, I'd like to look at the days where I enter the satisfaction after the days to see if there is a positive bias. I think I like to romanticise the past and it would be cool to see if that's really what I do.
```{r, warning=FALSE,message=FALSE, echo = FALSE}
library(tidyverse)
library(lubridate)
Combined$Satisfaction.Entry <- hms::as.hms(Combined$Satisfaction.Entry)
ggplot(Combined, aes(x = Satisfaction.Entry)) + geom_density(fill = "royalblue") + theme_classic()
ggplot(Combined, aes(x = Satisfaction.Entry, y = Satisfaction)) + geom_point(aes(color = Satisfaction)) + theme_classic() + theme(legend.position = "none",text = element_text(size=18))+ scale_color_viridis_c() + labs(x = "Entry Time", y="Satisfaction on a 1-10 Scale", title = "When I enter the information later I'm more satisfied") + ylim(0,10)
```
Actually it looks like my average answers 7-8 come out later in the day.