library(tidyverse) count_data_fp <-"/mmfs1/gscratch/comdata/users/mjilg/mw-repo-lifecycles/case1/event_0215_ve_weekly_commit_count_data.csv" input_df <- read.csv(count_data_fp, header = TRUE) input_df$nonbot_commit_count <- input_df$commit_count - input_df$bot_commit_count window_num <- 19 input_df <- input_df |> filter(relative_week >= (- window_num) & relative_week <= (window_num)) library(scales) library(ggplot2) time_plot <- input_df |> ggplot(aes(x=relative_week, y=wikimedia_commit_count)) + labs(x="Weekly Offset", y="Wikimedia Commit Count") + geom_smooth() + geom_vline(xintercept = 0)+ theme_bw() + theme(legend.position = "top") time_plot library(dplyr) share_df <- input_df |> mutate(wikimedia_share = wikimedia_commit_count / nonbot_commit_count) |> mutate(wikia_share = wikia_commit_count / nonbot_commit_count) |> mutate(gerrit_share = jenkins_commit_count / nonbot_commit_count) |> mutate(mw_dev_share = mediawiki_dev_commit_count / nonbot_commit_count) |> mutate(other_share = (nonbot_commit_count - jenkins_commit_count - wikia_commit_count - wikimedia_commit_count - mediawiki_dev_commit_count) / nonbot_commit_count)|> drop_na() share_long <- share_df |> dplyr::select(relative_week, wikimedia_share, wikia_share, gerrit_share, mw_dev_share, other_share) |> pivot_longer(cols = c(wikimedia_share, wikia_share, gerrit_share, mw_dev_share, other_share), names_to = "category", values_to = "share") share_plot <- share_long |> ggplot(aes(x=relative_week, y=share, color=category)) + geom_smooth() + geom_vline(xintercept = 0)+ labs(x = "Relative Week", y = "Share of Nonbot Commit Count", color = "Affiliation") + ggtitle("Weekly Share of Nonbot Commit Count by Affiliation") + theme_bw() + theme(legend.position = "top") share_plot