-
Notifications
You must be signed in to change notification settings - Fork 9
/
02c-analysis-protest-network.Rmd
53 lines (30 loc) · 1.36 KB
/
02c-analysis-protest-network.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
---
title: "Application: Analyzing the structure of online protest networks"
author: Pablo Barbera
date: "June 27, 2017"
output: html_document
---
#### Application
As an exercise, now we'll analyze a network of retweets. This data comes from our PLOS ONE paper, and it consists on the retweets of tweets mentioning "minimum wage" in the first 20 days of February 2014.
Just like earlier, we'll start reading the data in R:
```{r, echo=FALSE, message=FALSE}
library(igraph)
edges <- read.csv("data/mwage-edges.csv", stringsAsFactors=F)
nodes <- read.csv("data/mwage-nodes.csv", stringsAsFactors=FALSE)
g <- graph_from_data_frame(d=edges, vertices=nodes, directed=TRUE)
V(g)$name <- V(g)$screen_name # we add screen names as labels to make them more informative
```
Note that the network here is directed!
Now let's try to answer some basic questions:
Who were the users that retweeted the most? And the users that were most retweeted?
```{r}
```
Who are the users with the highest levels of centrality?
```{r}
```
How many components are there in this network? Do you think it makes sense to keep the giant component?
```{r}
```
Now run a community detection algorithm. Note that this may take a while! How many communities do you find? You can then run `head(table(membership(comm)))` to see how many users are in the first 6 communities. What does it tell you?
```{r}
```