Downloads bugs from https://s3.amazonaws.com/gitbugs/index.html for rstudio/sparklyr then, import:
library(readr)
gitbugs <- read_csv("~/Downloads/gitbugs.csv",
col_types = cols_only(closed_at = col_datetime(format = "%Y-%m-%dT%H:%M:%SZ"),
created_at = col_datetime(format = "%Y-%m-%dT%H:%M:%SZ"),
title = col_guess(),
labels_0_name = col_guess()))
first create a range of dates:
bugsRange <- seq(as.Date("2016/1/1"), as.Date("2017/10/1"), "days")
get all labels,
labels <- unique(gitbugs$labels_0_name)
then calculate active bugs per day,
activeBugs <- sapply(bugsRange, function(i) {
nrow(gitbugs[
gitbugs$created_at <= as.POSIXct(i) &
(is.na(gitbugs$closed_at) | gitbugs$closed_at > as.POSIXct(i)), ])
})
bugsTable <- data.frame(date = bugsRange, total = activeBugs, label = "all")
and plot active bugs per day:
library(ggplot2)
allBugs <- bugsTable[bugsTable$label == "all",]
ggplot(allBugs, aes(x = date, y = total)) + geom_line()
library(dplyr)
##
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
openBugs <- gitbugs %>% filter(is.na(closed_at)) %>% transmute(label = labels_0_name)
ggplot(openBugs, aes(label)) + coord_flip() + geom_bar()