Analyzing Social Media Data in R
Sowmya Vivek
Data Science Coach
library(igraph)
# Calculate out-degree
out_deg <- degree(nw_rtweet,
"OutfitAww",
mode = c("out"))
out_deg
OutfitAww
20
library(igraph)
# Calculate in degree
in_deg <- degree(nw_rtweet,
"OutfitAww",
mode = c("in"))
in_deg
OutfitAww
23
# Calculate the out-degree scores
out_degree <- degree(nw_rtweet, mode = c("out"))
# Sort the users in descending order of out-degree scores
out_degree_sort <- sort(out_degree, decreasing = TRUE)
# View the top 3 users
out_degree_sort[1:3]
VanesEtim RedNileShop w3daily
209 147 62
# Calculate the in-degree scores
in_degree <- degree(nw_rtweet, mode = c("in"))
# Sort the users in descending order of in-degree scores
in_degree_sort <- sort(in_degree, decreasing = TRUE)
# View the top 3 users
in_degree_sort[1:3]
XyC_129 SocialBflyMag jisoupy
171 167 142
# Calculate the betweenness scores of the network
betwn_nw <- betweenness(nw_rtweet, directed = TRUE)
# Sort the users in descending order of betweenness scores
betwn_nw_sort <- betwn_nw %>%
sort(decreasing = TRUE) %>%
round()
# View the top 3 users
betwn_nw_sort[1:3]
GuruOfficial Home_and_Loving SimplyTasheena
65 54 40
Analyzing Social Media Data in R