Skip to content

Instantly share code, notes, and snippets.

View epijim's full-sized avatar

James Black epijim

View GitHub Profile
@epijim
epijim / index.js
Created April 29, 2014 14:25
requirebin sketch
var d3 = require('d3')
, _ = require('underscore')
, w = window.innerWidth
, h = window.innerHeight - 100
, tempo = 500
// , data = {
// 'Derek Jeter' : {
// '1995' : [12, 48]
// , '1996' : [183, 582]
// }
var d3 = require('d3')
, _ = require('underscore')
, w = window.innerWidth
, h = window.innerHeight - 100
, tempo = 500
// , data = {
// 'Derek Jeter' : {
// '1995' : [12, 48]
// , '1996' : [183, 582]
// }
@epijim
epijim / index.js
Last active August 29, 2015 14:00
requirebin sketch
var d3 = require('d3')
, _ = require('underscore')
, w = window.innerWidth
, h = window.innerHeight - 100
, tempo = 500
// , data = {
// 'Derek Jeter' : {
// '1995' : [12, 48]
// , '1996' : [183, 582]
// }
@epijim
epijim / index.js
Created April 28, 2014 20:16 — forked from vicapow/index.js
requirebin sketch
var d3 = require('d3')
, _ = require('underscore')
, w = window.innerWidth
, h = window.innerHeight - 100
, tempo = 500
// , data = {
// 'Derek Jeter' : {
// '1995' : [12, 48]
// , '1996' : [183, 582]
// }
@epijim
epijim / index.js
Last active August 29, 2015 14:00
requirebin sketch
var d3 = require('d3')
, _ = require('underscore')
, w = window.innerWidth
, h = window.innerHeight - 100
, tempo = 500
// , data = {
// 'Derek Jeter' : {
// '1995' : [12, 48]
// , '1996' : [183, 582]
// }
Country Visits Per New Visits New Visits Bounce Rate Pages per Visit Avg Visit Duration
United Kingdom 11472 37.89% 4347 48.57% 2.34 00:02:47
United States of America 855 63.04% 539 68.30% 2.07 00:01:54
Germany 280 43.57% 122 47.14% 2.51 00:02:30
Australia 215 58.14% 125 46.98% 2.77 00:03:30
China 137 50.36% 69 56.20% 2.18 00:03:15
Canada 106 70.75% 75 43.40% 3.16 00:04:23
South Africa 92 36.96% 34 23.91% 3.86 00:06:19
Netherlands 88 60.23% 53 53.41% 3.06 00:01:55
Japan 77 53.25% 41 41.56% 2.92 00:02:42
@epijim
epijim / AtcSearch.R
Created February 11, 2014 15:40 — forked from Xachriel/AtcSearch.R
require(gdata)
require("RCurl")
require("XML")
AtcSearch <- function(AtcCodes){
#Function inside a function is bad practice...
#DummySearch searches for one atc code
DummySearch <- function(Code){
#A link to WHO search
setwd("~/Dropbox/Personal/fun with code/sankey_arrow")
sourc.https <- function(url, ...) {
# install and load the RCurl package
if (match('RCurl', nomatch=0, installed.packages()[,1])==0) {
install.packages(c("RCurl"), dependencies = TRUE)
require(RCurl)
} else require(RCurl)
# parse and evaluate each .R script
@epijim
epijim / Sankey.R
Last active August 29, 2015 13:56 — forked from aaronberdanier/Sankey.R
SankeyR <- function(inputs, losses, unit, labels, format="plot"){
########################
# SankeyR version 1.01 (updated August 10, 2010)
# is a function for creating Sankey Diagrams in R.
# See http://www.sankey-diagrams.com for excellent examples of Sankey Diagrams.
#
# OPTIONS:
# 'inputs' is a vector of input values
# 'losses' is a vector of loss values
# 'unit' is a string of the unit
@epijim
epijim / college_data.csv
Last active August 29, 2015 13:56
Cambridge college data
We can make this file beautiful and searchable if this error is corrected: It looks like row 6 should actually have 37 columns, instead of 16 in line 5.
College,Grad_coll,Wine_budget,Fellows,Students,Grads,PhD,Other,Rating,Part_time,Undergrad_applications ,Undergrad_acceptances ,Undergrad_acceptRate,Founded,Percent_male,Percent_female,Fixed_assets,Tompkin_1997,Tompkin_1998,Tompkin_1999,Tompkin_2000,Tompkin_2001,Tompkin_2002,Tompkin_2003,Tompkin_2004,Tompkin_2005,Tompkin_2006,Tompkin_2007,Tompkin_2008,Tompkin_2009,Tompkin_2010,Tompkin_2011,Tompkin_2012,Tompkin_2013,Tompkin_Mean09to13,TompkinsScore_2013,Firsts_2013
Christ's,FALSE,71055,84,617,208,127,81,B,Yes,451,99,22,1505,58,42,66602000,3,2,1,1,1,4,2,2,4,6,2,8,13,12,6,9,8,4.9,66.76,24.7
Churchill,FALSE,87685,165,770,290,190,100,B,Yes,350,89,25,1960,71,29,105978346,15,13,20,15,9,10,9,19,18,13,15,6,7,3,10,5,5,11.3,68.17,28.3
Clare,FALSE,79989,120,816,312,190,122,A,Yes,573,134,23,1326,52,48,70707000,11,6,15,9,6,3,6,4,9,12,17,13,18,8,4,11,11,9.6,66.08,25.3
Clare Hall,TRUE,17400,67,181,181,96,85,B,Yes,,,,1965,47,53,10579203,,,,,,,,,,,,,,,,,,,,
Corpus Christi,FALSE,79254,54,483,223,145,78,B,Yes,200,68,34,1352,60,40