Discussion Social Network Analysis: GitHub repository from @meteakca
What do you think this code will do?
edgelist1 <- read_csv("data/meteakca_edgelist.csv", show_col_types = FALSE) %>% mutate(group = week, week = substr(week, 1, 1) ) %>% group_by(from, to) %>% mutate(weight = n())glimpse(edgelist1)
Discussion Social Network Analysis: GitHub repository from @meteakca
Let's see!
edgelist1 <- read_csv("data/meteakca_edgelist.csv", show_col_types = FALSE) %>% mutate(group = week, week = substr(week, 1, 1) ) %>% group_by(from, to) %>% mutate(weight = n()) %>% distinct(from, to, weight)glimpse(edgelist1)
## Rows: 182## Columns: 3## Groups: from, to [182]## $ from <chr> "AL", "VW", "RN", "CH", "KW", "KJ", "Kwi", "AM", "KW", "KW", "Z…## $ to <chr> "RN", "RN", "KW", "RN", "CH", "CH", "CH", "KW", "AM", "AL", "AL…## $ weight <int> 1, 1, 1, 1, 2, 3, 1, 2, 2, 2, 1, 2, 1, 1, 1, 3, 1, 2, 1, 1, 1, …
head(edgelist1, 15)
## # A tibble: 15 × 3## # Groups: from, to [15]## from to weight## <chr> <chr> <int>## 1 AL RN 1## 2 VW RN 1## 3 RN KW 1## 4 CH RN 1## 5 KW CH 2## 6 KJ CH 3## 7 Kwi CH 1## 8 AM KW 2## 9 KW AM 2## 10 KW AL 2## 11 ZT AL 1## 12 LW AL 2## 13 RS AL 1## 14 SP AL 1## 15 JK AL 1
graph1 <- tidygraph::as_tbl_graph(edgelist1)
graph1 <- tidygraph::as_tbl_graph(edgelist1)
igraph::gorder(graph1)
= 23graph1 <- tidygraph::as_tbl_graph(edgelist1)
Order: igraph::gorder(graph1)
= 23
Size: igraph::gsize(graph1)
= 182
graph1 <- tidygraph::as_tbl_graph(edgelist1)
Order: igraph::gorder(graph1)
= 23
Size: igraph::gsize(graph1)
= 182
Diameter: igraph::diameter(graph1)
= 4
graph1 <- tidygraph::as_tbl_graph(edgelist1)
Order: igraph::gorder(graph1)
= 23
Size: igraph::gsize(graph1)
= 182
Diameter: igraph::diameter(graph1)
= 4
Density: igraph::edge_density(graph1)
= 0.36
graph1 <- tidygraph::as_tbl_graph(edgelist1)
Order: igraph::gorder(graph1)
= 23
Size: igraph::gsize(graph1)
= 182
Diameter: igraph::diameter(graph1)
= 4
Density: igraph::edge_density(graph1)
= 0.36
Node degree: igraph::degree(graph1, mode = 'all')
= 15
graph1 <- tidygraph::as_tbl_graph(edgelist1)
Order: igraph::gorder(graph1)
= 23
Size: igraph::gsize(graph1)
= 182
Diameter: igraph::diameter(graph1)
= 4
Density: igraph::edge_density(graph1)
= 0.36
Node degree: igraph::degree(graph1, mode = 'all')
= 15
igraph::degree(graph1, mode = 'in')
= 8graph1 <- tidygraph::as_tbl_graph(edgelist1)
Order: igraph::gorder(graph1)
= 23
Size: igraph::gsize(graph1)
= 182
Diameter: igraph::diameter(graph1)
= 4
Density: igraph::edge_density(graph1)
= 0.36
Node degree: igraph::degree(graph1, mode = 'all')
= 15
In-degree: igraph::degree(graph1, mode = 'in')
= 8
Out-degree: igraph::degree(graph1, mode = 'out')
= 8
graph1 <- tidygraph::as_tbl_graph(edgelist1)
Order: igraph::gorder(graph1)
= 23
Size: igraph::gsize(graph1)
= 182
Diameter: igraph::diameter(graph1)
= 4
Density: igraph::edge_density(graph1)
= 0.36
Node degree: igraph::degree(graph1, mode = 'all')
= 15
In-degree: igraph::degree(graph1, mode = 'in')
= 8
Out-degree: igraph::degree(graph1, mode = 'out')
= 8
Reciprocity: igraph::reciprocity(graph1)
= 0.663
graph1 <- tidygraph::as_tbl_graph(edgelist1)
Order: igraph::gorder(graph1)
= 23
Size: igraph::gsize(graph1)
= 182
Diameter: igraph::diameter(graph1)
= 4
Density: igraph::edge_density(graph1)
= 0.36
Node degree: igraph::degree(graph1, mode = 'all')
= 15
In-degree: igraph::degree(graph1, mode = 'in')
= 8
Out-degree: igraph::degree(graph1, mode = 'out')
= 8
Reciprocity: igraph::reciprocity(graph1)
= 0.663
Transitivity: igraph::transitivity(graph1)
= 0.653
What do you think this code will do?
sociogram1 <- graph1 %>% mutate(popularity = centrality_degree(mode = 'in')) %>% ggraph(layout = 'kk') + geom_edge_arc(alpha = .2, width = .5, strength = .5, color = 'steelblue' ) + geom_node_point(alpha = .4, aes(size = popularity)) + scale_size(range = c(1,10)) + theme_wsj() + scale_colour_wsj("colors6") + theme(axis.line=element_blank(), axis.text.x=element_blank(), axis.text.y=element_blank(), axis.ticks.x =element_blank(), axis.ticks.y =element_blank(), axis.title.x=element_blank(), axis.title.y=element_blank(), panel.background=element_blank(), panel.border=element_blank(), panel.grid.major=element_blank(), panel.grid.minor=element_blank())
Let's see!
sociogram1 <- graph1 %>% mutate(popularity = centrality_degree(mode = 'in')) %>% ggraph(layout = 'kk') + geom_edge_arc(alpha = .2, width = .5, strength = .5, color = 'steelblue' ) + geom_node_point(alpha = .4, aes(size = popularity)) + scale_size(range = c(1,10)) + theme_wsj() + scale_colour_wsj("colors6") + theme(axis.line=element_blank(), axis.text.x=element_blank(), axis.text.y=element_blank(), axis.ticks.x =element_blank(), axis.ticks.y =element_blank(), axis.title.x=element_blank(), axis.title.y=element_blank(), panel.background=element_blank(), panel.border=element_blank(), panel.grid.major=element_blank(), panel.grid.minor=element_blank())
Article: A social network perspective on peer supported learning in MOOCs for educators (Kellogg, Booth, & Oliver, 2014)
Data source: Massively Open Online Course for Educators (MOOC-Ed) network dataset]
What do you think this code will do?
edgelist2 <- read_csv("data/DLT1 Edgelist.csv", show_col_types = FALSE) %>% group_by(Sender, Receiver) %>% mutate(Weight = n()) %>% ungroup() %>% relocate(Sender, Receiver, Weight)glimpse(edgelist2)
Let's see!
edgelist2 <- read_csv("data/DLT1 Edgelist.csv", show_col_types = FALSE) %>% group_by(Sender, Receiver) %>% mutate(Weight = n()) %>% distinct(Sender, Receiver, Weight)glimpse(edgelist2)
## Rows: 1,978## Columns: 3## Groups: Sender, Receiver [1,978]## $ Sender <dbl> 360, 356, 344, 392, 219, 318, 4, 355, 355, 310, 248, 150, 19,…## $ Receiver <dbl> 444, 444, 444, 444, 444, 444, 444, 356, 444, 444, 444, 444, 3…## $ Weight <int> 1, 2, 1, 1, 3, 2, 4, 1, 2, 1, 1, 2, 1, 1, 7, 1, 3, 1, 2, 1, 1…
head(edgelist2, 15)
## # A tibble: 15 × 3## # Groups: Sender, Receiver [15]## Sender Receiver Weight## <dbl> <dbl> <int>## 1 360 444 1## 2 356 444 2## 3 344 444 1## 4 392 444 1## 5 219 444 3## 6 318 444 2## 7 4 444 4## 8 355 356 1## 9 355 444 2## 10 310 444 1## 11 248 444 1## 12 150 444 2## 13 19 310 1## 14 216 19 1## 15 19 444 7
graph2 <- tidygraph::as_tbl_graph(edgelist2)
Order: igraph::gorder(graph2)
= 442
Size: igraph::gsize(graph2)
= 1978
Diameter: igraph::diameter(graph2)
= 8
Density: igraph::edge_density(graph2)
= 0.01
Node degree: igraph::degree(graph2, mode = 'all')
= 4
In-degree: igraph::degree(graph2, mode = 'in')
= 1
Out-degree: igraph::degree(graph2, mode = 'out')
= 2
Reciprocity: igraph::reciprocity(graph2)
= 0.219
Transitivity: igraph::transitivity(graph2)
= 0.089
sociogram2 <- graph2 %>% mutate(popularity = centrality_degree(mode = 'in')) %>% ggraph(layout = 'kk') + geom_edge_arc(alpha = .2, width = .5, strength = .5, color = 'steelblue' ) + geom_node_point(alpha = .4, aes(size = popularity)) + scale_size(range = c(1,10)) + theme_wsj() + scale_colour_wsj("colors6") + theme(axis.line=element_blank(), axis.text.x=element_blank(), axis.text.y=element_blank(), axis.ticks.x =element_blank(), axis.ticks.y =element_blank(), axis.title.x=element_blank(), axis.title.y=element_blank(), panel.background=element_blank(), panel.border=element_blank(), panel.grid.major=element_blank(), panel.grid.minor=element_blank())
R package demo: Using tidytags with a conference hashtag (Staudt Willet & Rosenberg, 2022)
What do you think this code will do?
google_sheet_url <- "18clYlQeJOc6W5QRuSlJ6_v3snqKJImFhU42bRkM_OX8"google_sheet_data <- google_sheet_url %>% tidytags::read_tags()extra_tweet_data <- tidytags::pull_tweet_data(google_sheet_data) %>% tidytags::process_tweets()edgelist3 <- tidytags::create_edgelist(extra_tweet_data) %>% group_by(sender, receiver) %>% mutate(weight = n()) %>% distinct(sender, receiver, weight)
write_csv(edgelist3, "data/tidytags-edgelist.csv")
Let's see!
edgelist3 <- read_csv("data/tidytags-edgelist.csv", show_col_types = FALSE) glimpse(edgelist3)
## Rows: 1,577## Columns: 3## $ sender <chr> "lbukunAA", "bretsw", "bretsw", "bretsw", "AECT", "correia65"…## $ receiver <chr> "lbukunAA", "bretsw", "eromerohall", "FakeBobGagne", "jmenglu…## $ weight <dbl> 1, 6, 3, 4, 2, 6, 6, 6, 6, 2, 7, 2, 15, 2, 2, 4, 18, 8, 2, 6,…
head(edgelist3, 15)
## # A tibble: 15 × 3## sender receiver weight## <chr> <chr> <dbl>## 1 lbukunAA lbukunAA 1## 2 bretsw bretsw 6## 3 bretsw eromerohall 3## 4 bretsw FakeBobGagne 4## 5 AECT jmenglund03 2## 6 correia65 AnnaRoseLeach 6## 7 caranorth11 FredWBaker 6## 8 PaulineMuljana tintinluo 6## 9 PaulineMuljana AmyLomellini_ID 6## 10 PaulineMuljana WEHSLibrary 2## 11 PaulineMuljana robmoore3 7## 12 PaulineMuljana soniastic 2## 13 nicolapallitt aectclt 15## 14 nicolapallitt eromerohall 2## 15 michaelmgrant FakeBobGagne 2
graph3 <- tidygraph::as_tbl_graph(edgelist3)
Order: igraph::gorder(graph3)
= 511
Size: igraph::gsize(graph3)
= 1577
Diameter: igraph::diameter(graph3)
= 23
Density: igraph::edge_density(graph3)
= 0.006
Node degree: igraph::degree(graph3, mode = 'all')
= 2
In-degree: igraph::degree(graph3, mode = 'in')
= 1
Out-degree: igraph::degree(graph3, mode = 'out')
= 1
Reciprocity: igraph::reciprocity(graph3)
= 0.263
Transitivity: igraph::transitivity(graph3)
= 0.09
sociogram3 <- graph3 %>% mutate(popularity = centrality_degree(mode = 'in')) %>% ggraph(layout = 'kk') + geom_edge_arc(alpha = .2, width = .5, strength = .5, color = 'steelblue' ) + geom_node_point(alpha = .4, aes(size = popularity)) + scale_size(range = c(1,10)) + theme_wsj() + scale_colour_wsj("colors6") + theme(axis.line=element_blank(), axis.text.x=element_blank(), axis.text.y=element_blank(), axis.ticks.x =element_blank(), axis.ticks.y =element_blank(), axis.title.x=element_blank(), axis.title.y=element_blank(), panel.background=element_blank(), panel.border=element_blank(), panel.grid.major=element_blank(), panel.grid.minor=element_blank())
Variable | Classroom | MOOC | |
---|---|---|---|
Order | 23.000 | 442.000 | 511.000 |
Size | 182.000 | 1978.000 | 1577.000 |
Diameter | 4.000 | 8.000 | 23.000 |
Density | 0.360 | 0.010 | 0.006 |
Median Degree | 15.000 | 4.000 | 2.000 |
In-Degree | 8.000 | 1.000 | 1.000 |
Out-Degree | 8.000 | 2.000 | 1.000 |
Reciprocity | 0.663 | 0.219 | 0.263 |
Transitivity | 0.653 | 0.089 | 0.090 |
(Five minutes in groups, five minutes together)
Beginners:
Intermediates:
Experts:
Keyboard shortcuts
↑, ←, Pg Up, k | Go to previous slide |
↓, →, Pg Dn, Space, j | Go to next slide |
Home | Go to first slide |
End | Go to last slide |
Number + Return | Go to specific slide |
b / m / f | Toggle blackout / mirrored / fullscreen mode |
c | Clone slideshow |
p | Toggle presenter mode |
t | Restart the presentation timer |
?, h | Toggle this help |
Esc | Back to slideshow |