79 lines
3.1 KiB
R
79 lines
3.1 KiB
R
library(tidyverse)
|
|
count_data_fp <-"/mmfs1/gscratch/comdata/users/mjilg/mw-repo-lifecycles/case2/relevant_event_0413_mediawiki_core_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
|
|
|
|
library(scales)
|
|
library(ggplot2)
|
|
|
|
long_df <- input_df |>
|
|
tidyr::pivot_longer(cols = c(nonbot_commit_count, unaff_new_commit_count, wmf_new_commit_count),
|
|
names_to = "commit_type",
|
|
values_to = "lengthened_commit_count")
|
|
|
|
affiliationColors <-
|
|
setNames( c('black','#5da2d8', '#c7756a')
|
|
,c("nonbot_commit_count","unaff_new_commit_count", "wmf_new_commit_count"))
|
|
|
|
new_authors <- long_df |>
|
|
ggplot(aes(x=relative_week,
|
|
y=lengthened_commit_count,
|
|
color=factor(commit_type))) +
|
|
geom_point() +
|
|
geom_line() +
|
|
labs(x = "Relative Week", y = "Commits", color="Commit Type") +
|
|
scale_color_manual(values = affiliationColors,
|
|
labels = c("nonbot_commit_count" = "Total Nonbot Commits",
|
|
"unaff_new_commit_count" = "New Unaffiliated Commits",
|
|
"wmf_new_commit_count" = "New WMF Commits")) +
|
|
ggtitle("relevant MW-core Commits Around HTTPS as-default ('New' contributors <= 5 commits before 08-01-2013)") +
|
|
theme_bw() +
|
|
theme(legend.position = "top")
|
|
new_authors
|
|
|
|
ggsave(filename = "0403-https-core-event-new-commits.png", plot = new_authors, width = 12, height = 9, dpi = 800)
|
|
|
|
|
|
window_num <- 12
|
|
intermediate_df <- input_df |>
|
|
mutate(nonbot_commit_count = commit_count - bot_commit_count)|>
|
|
mutate(other_commit_count = nonbot_commit_count - mediawiki_dev_commit_count - wikimedia_commit_count) |>
|
|
mutate(wikimedia_commit_count = wikimedia_commit_count + mediawiki_dev_commit_count) |>
|
|
dplyr::select(-mediawiki_dev_commit_count) |>
|
|
dplyr::select(-wikia_commit_count) |>
|
|
filter(relative_week >= (- window_num) & relative_week <= (window_num))
|
|
|
|
time_plot <- intermediate_df |>
|
|
ggplot(aes(x=relative_week, y=nonbot_commit_count)) +
|
|
labs(x="Weekly Offset", y="Nonbot Commit Count") +
|
|
geom_smooth() +
|
|
geom_vline(xintercept = 0)+
|
|
theme_bw() +
|
|
theme(legend.position = "top")
|
|
time_plot
|
|
|
|
library(dplyr)
|
|
|
|
share_df <- intermediate_df |>
|
|
mutate(wikimedia_share = wikimedia_commit_count / nonbot_commit_count) |>
|
|
mutate(other_share = other_commit_count / nonbot_commit_count)|>
|
|
drop_na()
|
|
|
|
share_long <- share_df |>
|
|
dplyr::select(relative_week, wikimedia_share, other_share) |>
|
|
pivot_longer(cols = c(wikimedia_share, other_share), names_to = "category", values_to = "share")
|
|
|
|
commit_share_plot <- share_long |>
|
|
ggplot(aes(x=relative_week,
|
|
y=share,
|
|
color=category)) +
|
|
geom_line() +
|
|
geom_point() +
|
|
labs(x = "Relative Week", y = "Share of Nonbot Commits", color="Commit Author Affiliation") +
|
|
scale_color_discrete(labels = c("Unaffiliated", "Organizationally Affiliated")) +
|
|
ggtitle("MW-core Nonbot 'relevant' Commit Share Around HTTPS-as-default") +
|
|
theme_bw() +
|
|
theme(legend.position = "top")
|
|
commit_share_plot
|