Skip to content

Instantly share code, notes, and snippets.

View chendaniely's full-sized avatar

Daniel Chen chendaniely

View GitHub Profile
@chendaniely
chendaniely / plot_edge_list.R
Created April 23, 2015 15:31
Plot a recurrent artificial neural network using igraph and base graphics
library(igraph)
# get my dataset from the structure.R file
source('structure.R')
# create graph from edgelist
# note it has to be a matrix, not a dataframe
g <- graph.edgelist(as.matrix(edge_list_values[, names(edge_list_values) %in%
c("j_name", "i_name")]))
g
@chendaniely
chendaniely / Facet by Continents
Last active August 29, 2015 14:15
SWC Plot This Post
library(stringr)
library(plyr)
library(ggplot2)
parse_row <- function(row_values){
keep <- row_values[1]
keep <- as.character(keep)
split_keep <- str_split_fixed(string = keep, pattern = ' ', n = 5)
continent_code <- split_keep[1]
country_code_2 <- split_keep[2]