knitr::opts_chunk$set(echo = FALSE)
library(rotspot)
library(ggplot2)
library(ggbeeswarm)

dat <- params$dat

n_pkgs <- length(unique(dat$pkg))
dat[author %in% c("stefan.b.fleck@gmail.com", "FLECK Stefan", "Stefan", "stefan", "stefan.fleck", "Stefan Fleck - U", "s_fleck"), author := "Stefan Fleck"]

By package

plot(dat) 

By Author

  dd <- dat[, .(
    commits = length(unique(hash))
  ), 
    by = c("date", "author")
  ]

  order <- dd[, .(commits = sum(commits)), by = "author"]
  data.table::setkeyv(order, "commits")
  dd[, author := factor(author, levels = rev(order$author))]


  ggplot2::ggplot(
    dd,
    ggplot2::aes(
      x = date,
      y = commits)
  ) +
    ggplot2::geom_bar(stat = "identity", color = "#B4DE2CFF") +
    ggplot2::theme_dark() +
    ggplot2::facet_grid(author ~ .) 

Weekdays

  dd <- dat[
    author == "Stefan Fleck" & lines_added > 5, 
    .(
      commits = length(unique(hash))
    ), 
      by = c("date", "author")
  ]

  dd[, wday := hammr::wday2(date)]

  pdat <- dd

  ggplot(
    pdat,
    aes(
      x = wday,
      group = wday,
      y = commits
    )
  ) + 
    geom_boxplot()


s-fleck/rotspot documentation built on May 9, 2019, 7:37 a.m.