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
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) |
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
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 |
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
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") |
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
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", |
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
# 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 |
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
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) |
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{article} | |
\usepackage{graphicx} | |
\usepackage{caption} | |
\usepackage{subcaption} | |
\begin{document} | |
\begin{figure} | |
\centering |
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(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, |
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
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, |
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
# 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, |
OlderNewer