Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
ropenscilabs commit network using ghnet
remotes::install_github('yonicd/ghnet')
library(ghnet)
# get current github R repos using gepuro json file
universe <- fetch_gepuro()
# filter to ropenscilabs repos only
ropenscilabs_repos <- universe%>%
dplyr::filter(owner=='ropenscilabs')%>%
dplyr::select(-n)%>%
tidyr::unnest()
# fetch commit data from github api
ropenscilabs_repos1 <- ropenscilabs_repos%>%
dplyr::mutate(
commits = purrr::map(
repo,
ghnet::get_commit,owner = 'ropenscilabs'
)
)
# cleanup any null values and unnest the data
ropenscilabs <- ropenscilabs_repos1%>%
dplyr::filter(!purrr::map_lgl(commits,is.null))%>%
tidyr::unnest()
# create plots by year/month
p <- ropenscilabs%>%
dplyr::mutate(freq_var=format(date,'%Y/%m'))%>%
dplyr::group_split(freq_var)%>%
purrr::map(.f=function(x){
x%>%
ghnet::create_graph_data()%>%
ghnet::create_plot(add_labels = 'both') +
ggplot2::labs(
title = 'ropenscilabs contribution network',
subtitle = 'A brief history',
caption = 'Created with https://github.com/yonicd/ghnet'
)
})
#save gif
animation::saveGIF(expr = {
for(i in 1:length(p))
print(p[[i]])
},ani.width = 800)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.