Permalink
Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.
Sign up
Fetching contributors…
Cannot retrieve contributors at this time
--- | |
title: "Open Science MOOC" | |
output: | |
flexdashboard::flex_dashboard: | |
orientation: rows | |
css: style.css | |
logo: mooc-logo.png | |
favicon: mooc-logo.png | |
navbar: | |
- { title: "About", href: "https://dataplanes.org" } | |
source_code: https://github.com/lhehnke/osmooc-dashboard | |
--- | |
```{r, include = FALSE} | |
# Load flexdashboard | |
library(flexdashboard) | |
# Install and load packages using pacman | |
if (!require("pacman")) install.packages("pacman") | |
library(pacman) | |
p_load(ggraph, igraph, kableExtra, networkD3, plotly, tidygraph, tidyverse) | |
# Set directory | |
MAIN_DIR <- rprojroot::find_rstudio_root_file() | |
# Import data | |
load(file = paste(MAIN_DIR, "osmooc-github.RData", sep = "/")) | |
``` | |
Sidebar {.sidebar} | |
======================================================================= | |
### Hello, Open Scientist! | |
This dashboard gives you an overview of the repository statistics and user activities of the **[Open Science MOOC](https://opensciencemooc.eu/)** on [GitHub](https://github.com/opensciencemooc). | |
If you want to become part of *#TeamOpen*, you can join our ever-growing [Slack community](https://openmooc-ers.slack.com/) or follow us on [Twitter](https://twitter.com/opensciencemooc) for daily news on all things Open Science. | |
*Data for the analysis was collected on June 07, 2019.* | |
Overview {data-icon="fa-chart-line"} | |
======================================================================= | |
Row | |
----------------------------------------------------------------------- | |
### Module repositories {.value-box} | |
```{r} | |
repos <- nrow(repos_df_mod) | |
valueBox(repos, icon = "fa-github", color = "#91aac3") | |
``` | |
### Stars {.value-box} | |
```{r} | |
stars <- repos_df_mod %>% | |
summarize(sum(stargazers_count, na.rm = TRUE)) | |
valueBox(stars, icon = "fa-star", color = "#91aac3") | |
``` | |
### Forks {.value-box} | |
```{r} | |
forks <- repos_df_mod %>% | |
summarize(sum(forks_count, na.rm = TRUE)) | |
valueBox(forks, icon = "fa-code-fork", color = "#91aac3") | |
``` | |
Row {.tabset .tabset-fade data-height=350} | |
----------------------------------------------------------------------- | |
### Which modules are starred the most? | |
```{r} | |
# Plot most starred repos | |
p <- repos_df_mod %>% | |
select(name, stargazers_count) %>% | |
group_by(name) %>% | |
rename(Repository = name, Stars = stargazers_count) %>% | |
ungroup() %>% | |
mutate(Repository = reorder(Repository, Stars)) %>% | |
ggplot(aes(Repository, Stars)) + | |
geom_bar(stat = "identity", width = 0.5, alpha = 0.8, color = "#2c3e50", fill = "#2c3e50") + | |
xlab("") + ylab("") + | |
coord_flip() + theme_minimal() | |
ggplotly(p) | |
``` | |
### Which modules are forked the most? | |
```{r} | |
# Plot most forked repos | |
p2 <- repos_df_mod %>% | |
select(name, forks_count) %>% | |
group_by(name) %>% | |
rename(Repository = name, Forks = forks_count) %>% | |
ungroup() %>% | |
mutate(Repository = reorder(Repository, Forks)) %>% | |
ggplot(aes(Repository, Forks)) + | |
geom_bar(stat = "identity", width = 0.5, alpha = 0.8, color = "#2c3e50", fill = "#2c3e50") + | |
xlab("") + ylab("") + | |
coord_flip() + theme_minimal() | |
ggplotly(p2) | |
``` | |
Contributors | Collaboration network {data-icon="fa-users"} | |
======================================================================= | |
Row | |
----------------------------------------------------------------------- | |
### Contributions {.value-box} | |
```{r} | |
contributions <- contributors_df %>% | |
select(contributions) %>% | |
summarize(sum(contributions, na.rm = TRUE)) %>% | |
pull() | |
valueBox(contributions, icon = "fa-tasks", color = "#91aac3") | |
``` | |
### Contributors {.value-box} | |
```{r} | |
collaborators <- contributors_df %>% | |
select(login) %>% | |
unique() %>% | |
nrow() | |
valueBox(collaborators, icon = "fa-user", color = "#91aac3") | |
``` | |
### Collaborations {.value-box} | |
```{r} | |
collaborations <- contributors_df %>% | |
select(df_id, login) %>% | |
rename(repository = df_id, name = login) %>% | |
widyr::pairwise_count(name, repository, sort = TRUE, upper = FALSE) %>% | |
nrow() | |
valueBox(collaborations, icon = "fa-users", color = "#91aac3") | |
``` | |
Row {data-height=430} | |
----------------------------------------------------------------------- | |
### What does the collaboration network look like? {data-width=700} | |
This interactive graph shows the GitHub collaboration network. The top three contributors who collaborated the most are highlighted. Hover over a node to see the collaborator's name. | |
*** | |
```{r, include = FALSE} | |
# Build edgelist | |
collab <- contributors_df %>% | |
select(df_id, login) %>% | |
rename(repository = df_id, name = login) %>% | |
widyr::pairwise_count(name, repository, sort = TRUE, upper = FALSE) | |
# Convert to graph object | |
collab_graph <- graph_from_data_frame(collab, directed = FALSE) %>% | |
as_tbl_graph() | |
``` | |
```{r, include = FALSE} | |
# Compute network metrics | |
#members <- membership(cluster_walktrap(collab_graph)) | |
degree <- igraph::degree(collab_graph) | |
group <- ifelse(degree >= 40, "top", "regular") | |
weight <- E(collab_graph)$n | |
# Convert igraph graph to networkD3 object | |
collab_d3 <- igraph_to_networkD3(collab_graph, group = group) | |
# Set metrics as attributes | |
collab_d3$nodes$degree <- degree | |
collab_d3$links$weight <- weight | |
# Set custom color range for grouping variable | |
colors <- JS('d3.scaleOrdinal(["#7d3945", "#2c3e50"])') | |
``` | |
```{r} | |
# Plot interactive network | |
collab_network_d3 <- forceNetwork(Links = collab_d3$links, | |
Nodes = collab_d3$nodes, | |
Source = "source", | |
Target = "target", | |
NodeID = "name", | |
Nodesize = "degree", | |
Group = "group", | |
colourScale = colors, # node colors based on "group" | |
opacity = 0.8, | |
opacityNoHover = 0.1, | |
fontSize = 20, | |
fontFamily = "Lato", | |
Value = "weight", | |
linkColour = "#91aac3", | |
linkDistance = 150, | |
linkWidth = JS("function(d) { return d.value*2; }"), | |
charge = -50, | |
zoom = TRUE) | |
collab_network_d3 | |
``` | |
### Which contributors collaborated the most? {data-width=340} | |
```{r} | |
collab_graph %>% | |
mutate(centrality = centrality_degree(weight = n)) %>% | |
as_tibble() %>% | |
arrange(-centrality, name) %>% | |
top_n(10, centrality) %>% | |
rename(Contributor = name, "Degree centrality" = centrality) %>% | |
kable(escape = FALSE) %>% | |
kable_styling(bootstrap_options = c("striped", "hover")) | |
```{r} |