Alison Link
19 November 2015
New workplace, large college, no idea of who knows whom.
Solution…some kind of network-y “Rolodex”?
Thanks, Coursera!
library(igraph)
library(networkD3) # the library formerly known as "d3Network"
Two columns of people: 1) a team member 2) a “Rolodex” contact
Additional columns with attributes:
Read in the .CSV…
raw_csv_data <- read.csv("TEL Network Map - Spring 2015.csv", header=TRUE)
names(raw_csv_data) <- c('TELmember', 'CLAcontact', 'dept', 'context', 'notes', 'strength')
#head(raw_csv_data)
library(igraph)
We're in luck! The iGraph package's “graph_from_data_frame” takes as an argument…
“A data frame containing a symbolic edge list in the first two columns. Additional columns are considered as edge attributes. Since version 0.7 this argument is coerced to a data frame with as.data.frame.”
So, let's convert to an iGraph-friendly data format…
network_graph_data <- graph_from_data_frame(raw_csv_data, directed=FALSE)
Note: This is the simplest way to coerce our data into an iGraph-friendly format. It will treat all columns as edge attributes–something we may or may not want. For a more complicated version that supports vertex attributes, as well, look at the graph.data.frame
command.
Look at the vertices…
V(network_graph_data)
Look at the edges…
E(network_graph_data)
plot(network_graph_data)