-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathkarma.Rmd
146 lines (128 loc) · 4.3 KB
/
karma.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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
---
title: 'Overview of todo performance alla Todoist Karma'
output:
rmdformats::html_clean:
number_sections: false
theme: paper
highlight: default
dev: svg
df_print: kable
code_folding: show
fig_width: 16
self_contained: true
gallery: true
---
```{r set-options-read-chunks, echo=FALSE, message=FALSE, warning=FALSE, bootstrap.show.code = FALSE}
knitr::opts_chunk$set(results = 'markup', echo=TRUE, message=FALSE, warning=FALSE, dpi = 600,
fig.asp = 0.618)
options(width=120)
library(tidyverse)
library(ggplot2)
library(patchwork)
library(lemmens)
devtools::load_all()
palette <- 'Dark2'
```
```{r load-data}
loc <- '~/nextcloud/todo/'
tasks <- load_tasks(file.path(loc, 'todo.txt'))
done <- load_tasks(file.path(loc, 'done.txt'))
done_old <- load_tasks(file.path(loc, 'done - 2018-07-21.txt'))
tl <- bind_rows(tasks, done, done_old)
```
# Tasks completed per week
```{r completed-per-week}
dat <- tl %>%
filter(done == 'x ') %>%
mutate(week = as.numeric(format(date_completed, '%V')),
year = as.numeric(format(date_completed, '%Y'))) %>%
filter(!is.na(done)) %>%
count(year, week) %>%
filter(!is.na(year) | !is.na(week))
dat %>%
complete_years() %>%
complete(year, week) %>%
ggplot(mapping = aes(x = week, y = n)) +
geom_line(aes(group = 1), linewidth = 1.0, na.rm = FALSE) +
facet_wrap(~ year) +
labs(x = '\nWeek number', y = 'Number of task completed\n',
title = 'Number of tasks completed per week\n') +
theme_lemmens
```
Discovered that I've seem to lost about two and a half years worth of old tasks.
```{r completed-per-week-context}
n_colors <- tl %>% group_by_context() %>% distinct(context) %>% nrow()
long_palette <- colorRampPalette(RColorBrewer::brewer.pal(9, "Set1"))(n_colors)
tl %>%
mutate(week = as.numeric(format(date_completed, '%V')),
year = as.numeric(format(date_completed, '%Y'))) %>%
filter(!is.na(done)) %>%
group_by_context() %>%
count(context, year, week) %>%
ggplot(mapping = aes(x = week, y = n, colour = context)) + #, linetype = project)) +
geom_line(size = 1.0, na.rm = TRUE) +
facet_wrap(~ year) +
labs(x = 'Week number', y = 'Number of task completed',
title = 'Number of tasks completed per week\n') +
scale_colour_manual(values = long_palette) +
guides(colour = guide_legend(nrow = 2)) +
theme_lemmens
```
# Creation / due
```{r create-due-lag}
create_due <- tl %>%
filter(!is.na(date_created) & !is.na(date_due)) %>%
mutate(create_lag = date_due - date_created)
create_due %>%
group_by_context() %>%
ggplot(mapping = aes(x = create_lag, fill = context)) +
geom_histogram(binwidth = 1) +
scale_fill_manual(values = long_palette) +
coord_cartesian(xlim = c(0, 50)) +
theme_lemmens
```
# Timeliness of completion
Not too large of a distance between actual completing a task versus when it should have been completed; i.e.
relatively few delays/lags.
```{r due-done-lag}
due_done <- tl %>%
filter(!is.na(done)) %>%
mutate(due_lag = date_completed - date_due)
p1 <- due_done %>%
ggplot(mapping = aes(x = due_lag)) +
geom_histogram(binwidth = 1) +
theme_lemmens
## group_by(lst, tag) %>% use_series(due.lag) %>% mean_cl_boot(due.lag)
p2 <- p1 %+% (due_done %>% filter(due_lag >= 0)) +
coord_cartesian(xlim = c(0, 50))
p3 <- p1 %+% (due_done %>% filter(due_lag >= 1)) +
coord_cartesian(xlim = c(0, 50))
p1 + p2 + p3
```
```{r due-done-by-context}
due_done %>%
group_by_context() %>%
filter(due_lag >= 1) %>%
ggplot(mapping = aes(x = due_lag, fill = context)) +
geom_histogram(binwidth = 1) +
scale_fill_manual(values = long_palette) +
coord_cartesian(xlim = c(0, 50)) +
theme_lemmens
```
# Topics
```{r topics-over-time, fig.height = 9}
tl %>%
mutate(week = format(date_created, '%V'),
year = format(date_created, '%Y')) %>%
mutate(yw = as.numeric(paste0(year, week))) %>%
group_by_context() %>%
group_by_project() %>%
filter(!is.na(context) | !is.na(project)) %>%
ggplot(mapping = aes(x = yw, y = project, colour = context)) +
geom_line() +
labs(x = '\nYearWeek#', y = 'Project tag\n') +
scale_colour_manual(values = long_palette) +
guides(colour = guide_legend(nrow = 2)) +
theme_lemmens +
theme(axis.text.y = element_text(size = rel(0.5)))
```