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) |
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
# 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
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 ######################################################################### | |
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
#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
theme_bare <- theme(axis.line = element_blank(), | |
axis.text.x = element_blank(), | |
axis.text.y = element_blank(), | |
axis.ticks = element_blank(), | |
axis.title.x = element_blank(), | |
axis.title.y = element_blank(), | |
legend.position = "none") | |
cambridge <- get_map(location="Cambridge, UK", zoom=13, color="bw", source="osm") |
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("Directoy where the data is saved") | |
library(plyr) # used to read in csvs | |
library(psych) # has the describe function | |
################ | |
# import data # | |
################ | |
# Data is in monthly CSV's, so loop over them pulling in 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
library(ggmap) | |
getLineColor <- function(val) { | |
#pal <- colorRampPalette(c("#333333", "#ffffff", "#b5310c")) | |
pal <- colorRampPalette(c("#ffffff", "red")) | |
colors <- pal(80) | |
val.log <- log(val) | |
if (val > 50) { | |
col <- colors[80] |
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
\documentclass[12pt]{article} | |
\usepackage{sparklines} % makes inline curves | |
\begin{document} | |
Ten-year modelled CVD risk was 27.3 (SD 13.9, histogram | |
\begin{sparkline}{4} % start first sparkline | |
\sparkspike .083 .69 % first is x spacing, second is height | |
\sparkspike .25 .97 |