This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#I've merged code from two different sources, originally published by github users snowdonjames and Scarygami | |
#Import JSON, spit out KML | |
#usage.. location_history_json_converter.py input output [-h] [-f {kml,json,csv,js,gpx,gpxtracks}] [-v] | |
from __future__ import division | |
import sys | |
import json | |
import math |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# SETUP ######################################################################### | |
setwd("/Users/Jimmy/Dropbox/Personal/fun with code/xkcd") | |
library(xkcd) | |
library(extrafont) | |
library(ggplot2) | |
#Load scatter dataset | |
collegesdata <- read.csv("~/Dropbox/Personal/fun with code/xkcd/collegesdata.csv" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
setwd("~/R/RStudio/twitterwordcloud") | |
#install the necessary packages | |
#install.packages("ROAuth") | |
#install.packages("twitteR") | |
#install.packages("wordcloud") | |
#install.packages("tm") | |
library("ROAuth") | |
library("twitteR") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# SETUP ######################################################################### | |
#The following packages need to be installed | |
require(googleVis) | |
setwd("~/Dropbox/Personal/fun with code/GoogleVis") | |
# Load data ######################################################################### | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
############################################################################################### | |
## ## | |
## Setup ## | |
## ## | |
############################################################################################### | |
# install.packages("Rfacebook") # from CRAN | |
# install.packages("Rook") # from CRAN | |
# install.packages("igraph") # from CRAN |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
############################################################################# | |
####### Prelim stages ########## | |
############################################################################# | |
library(maps) | |
library(geosphere) | |
library(RCurl) | |
library(RJSONIO) | |
library(ggmap) | |
library(qdap) |
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |