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'
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)
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.
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
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
Not too large of a distance between actual completing a task versus when it should have been completed; i.e. relatively few delays/lags.
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
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
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)))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.