Skip to content

Instantly share code, notes, and snippets.

@yonicd
Created February 17, 2019 19:06
Show Gist options
  • Save yonicd/9dbeae4354f5131a3c85eb06e3295c43 to your computer and use it in GitHub Desktop.
Save yonicd/9dbeae4354f5131a3c85eb06e3295c43 to your computer and use it in GitHub Desktop.
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