Skip to content

Instantly share code, notes, and snippets.

@ColCarroll
Created July 2, 2013 02:53
Show Gist options
  • Save ColCarroll/5906469 to your computer and use it in GitHub Desktop.
Save ColCarroll/5906469 to your computer and use it in GitHub Desktop.
get_psu_sample <- function(){
nodeinfo <- read.table("http://www.stat.psu.edu/~dhunter/Rnetworks/nodal.attr.txt", head=T)
nodeinfo <<- cbind(1:nrow(nodeinfo),nodeinfo)
names(nodeinfo)[1] <<- "id"
myedges <<- read.table("http://www.stat.psu.edu/~dhunter/Rnetworks/edgelist.txt")
}
network_example <- function(){
require(network)
diseasenw <- network(myedges, directed=F, bipartite=132, vertex.attr = nodeinfo)
plot(diseasenw)
plot(diseasenw, vertex.col = 3-nodeinfo$race, vertex.sides = 2+nodeinfo$sex)
}
igraph_example <- function(){
require(igraph)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment