Skip to content

Instantly share code, notes, and snippets.

@altras
Created February 14, 2016 22:55
Show Gist options
  • Save altras/7ab3f0590fbaabb4a3fa to your computer and use it in GitHub Desktop.
Save altras/7ab3f0590fbaabb4a3fa to your computer and use it in GitHub Desktop.
Create a github style punchcard with a 1 line csv of commits with git log --pretty=format:"%ci"
library(lubridate)
library(ggplot2)
dates <- read.csv("2015-commits.csv", header = FALSE, stringsAsFactors = FALSE)
dates_parsed <- parse_date_time(dates, "%y-%m-%d %h:%M:%S %z")
cmtHours <- factor(hour(dates_parsed))
wkday <- factor(weekdays(dates_parsed), levels=c("понеделник", "вторник", "сряда", "четвъртък", "петък", "събота", "неделя"))
commits <- data.frame(cmtHours, wkday)
commits$freq <- apply(commits, 1, function(row) sum(row[1] == commits$cmtHour & row[2] == commits$wkday))
ggplot(commits, aes(commits$cmtHour, commits$wkday)) + geom_point(size=commits$freq / 5)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment