Skip to content

Instantly share code, notes, and snippets.

Shawn Mollie Taylor mollietaylor

Block or report user

Report or block mollietaylor

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@mollietaylor
mollietaylor / sectors.R
Created Sep 7, 2012
Map of prominent patent sectors of 50 largest U.S. cities in R
View sectors.R
sectors <- read.table("sectors.csv", header=TRUE, sep=",")
library(maps)
library(RColorBrewer)
library(classInt)
names(sectors)
plotvar <- sectors$secnum #change this line to change data
plotclr <- brewer.pal(5,"Set1")
class <- classIntervals(plotvar, 5, 'pretty')#or pretty
colcode <- findColours(class, plotclr)
map("state", ylim=range(50, 22), col=8)
@mollietaylor
mollietaylor / conventions.csv
Created Sep 8, 2012
Simple word cloud example in R
View conventions.csv
wordper25k democrats republicans
millionaires 7 0
arithmetic 3 0
equal pay 6 0
level playing field 2 0
bin laden 5 0
auto 18 1
fair 13 1
middle class 47 7
forward 33 6
@mollietaylor
mollietaylor / histdens.R
Created Sep 9, 2012
Histogram + Density Plot Combo in R
View histdens.R
png("beaverhist.png")
layout(matrix(c(1:2), 2, 1,
byrow = TRUE))
hist(beaver1$temp, # histogram
col = "peachpuff", # column color
border = "black",
prob = TRUE, # show densities instead of frequencies
xlim = c(36,38.5),
xlab = "temp",
main = "Beaver #1")
@mollietaylor
mollietaylor / histdens2.R
Created Sep 23, 2012
Adding Measures of Central Tendency to Histograms in R
View histdens2.R
png("beaverhistextra.png")
layout(matrix(c(1:2), 2, 1,
byrow = TRUE))
hist(beaver1$temp, # histogram
col = "peachpuff", # column color
border = "black",
prob = TRUE, # show densities instead of frequencies
xlim = c(36,38.5),
ylim = c(0,3),
xlab = "Temperature",
@mollietaylor
mollietaylor / reality.R
Created Oct 5, 2012
Random Name Generator in R
View reality.R
# recreating realitytvgenerator.com
# dictionary:
# define our two vectors with the names we'd like to use
first <- c("Fear", "Frontier", "Nanny", "Job", "Yard", "Airport", "Half Pint", "Commando", "Fast Food", "Basketball", "Bachelorette", "Diva", "Baggage", "College", "Octane", "Clean", "Sister", "Army", "Drama", "Backyard", "Pirate", "Shark", "Project", "Model", "Survival", "Justice", "Mom", "New York", "Jersey", "Ax", "Warrior", "Ancient", "Pawn", "Throttle", "The Great American", "Knight", "American", "Outback", "Celebrity", "Air", "Restaurant", "Bachelor", "Family", "Royal", "Surf", "Ulitmate", "Date", "Operation", "Fish Tank", "Logging", "Hollywood", "Amateur", "Craft", "Mystery", "Intervention", "Dog", "Human", "Rock", "Ice Road", "Shipping", "Modern", "Crocodile", "Farm", "Amish", "Single", "Tool", "Boot Camp", "Pioneer", "Kid", "Action", "Bounty", "Paradise", "Mega", "Love", "Style", "Teen", "Pop", "Wedding", "An American", "Treasure", "Myth", "Empire", "Motorway", "Room", "Casino", "Comedy", "Unde
View palettes-in-R.R
palette()
# it's fine for your vector to include a mixture of hex triplets and R color names:
colors <- c("#A7A7A7",
"dodgerblue",
"firebrick",
"forestgreen",
"gold")
hist(discoveries,
col = colors)
View subfigures.tex
\documentclass{article}
\usepackage{graphicx}
\usepackage{caption}
\usepackage{subcaption}
\begin{document}
\begin{figure}
\centering
@mollietaylor
mollietaylor / sort.R
Created Nov 13, 2012
Sorting Within Lattice Graphics in R
View sort.R
library(lattice)
colors = c("#1B9E77", "#D95F02", "#7570B3")
dotplot(rownames(mtcars) ~ mpg,
data = mtcars,
col = colors[1],
pch = 1)
dotplot(reorder(rownames(mtcars), cyl) ~ mpg,
data = mtcars,
View Mapping GPS Tracks in R
gps <- read.csv("out.csv",
header = TRUE)
library(ggmap)
mapImageData <- get_googlemap(center = c(lon = median(gps$Longitude), lat = median(gps$Latitude)),
zoom = 11,
# size = c(500, 500),
maptype = c("terrain"))
ggmap(mapImageData,
@mollietaylor
mollietaylor / stacked.R
Created Dec 11, 2012
Stacked Bar Charts in R
View stacked.R
# cite: http://stat.ethz.ch/R-manual/R-patched/library/stats/html/reshape.html
# cite: http://www.cs.grinnell.edu/~rebelsky/Courses/MAT115/2008S/R/stacked-bar-graphs.html
# cite: http://www.harding.edu/fmccown/r/#barcharts
library(RColorBrewer)
sequential <- brewer.pal(6, "BuGn")
Loblolly[1:10,]
wide <- reshape(Loblolly,
You can’t perform that action at this time.