Skip to content

Instantly share code, notes, and snippets.

View keithmcnulty's full-sized avatar

Keith McNulty keithmcnulty

View GitHub Profile
@keithmcnulty
keithmcnulty / season_by_season_networks.R
Created June 19, 2020 10:38
Visualize season by season force-directed networks
library(tidyverse)
library(jpeg)
source("network_analysis/friends_network.R")
# get friends full series edgelist
edgefile_url <- "https://github.com/keithmcnulty/friends_analysis/blob/master/data/friends_edgelist_by_season.RDS?raw=true"
download.file(edgefile_url, "edgelist.RDS")
edgelist <- readRDS("edgelist.RDS")
@keithmcnulty
keithmcnulty / friends_network.R
Created June 19, 2020 10:33
Function for generating Friends network visualizations
library(tidyverse)
library(readr)
library(igraph)
friends_network <- function(season = NULL, edgelist = NULL, type = c("mds", "sphere")) {
friends <- c("Phoebe", "Monica", "Rachel", "Joey", "Ross", "Chandler")
edgelist_matrix <- as.matrix(edgelist[ ,c("from", "to")])