This project can be used to generate Voronoi maps using D3 and Leaflet. This code was made by Chris Zeeter and the data comes from Beoir.org. See an explanation of the code.
The code is released under the The MIT License.
<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUA | |
AAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO | |
9TXL0Y4OHwAAAABJRU5ErkJggg=="/> |
<!doctype html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="Generator" content="EditPlus®"> | |
<meta name="Author" content=""> | |
<meta name="Keywords" content=""> | |
<meta name="Description" content=""> | |
<title>Document</title> |
This project can be used to generate Voronoi maps using D3 and Leaflet. This code was made by Chris Zeeter and the data comes from Beoir.org. See an explanation of the code.
The code is released under the The MIT License.
#read in SF crime data is at https://www.kaggle.com/c/sf-crime/data | |
mydata = read.csv("train.csv") | |
library(dplyr) | |
#break up times | |
mydata$Year <- year(mydata$Dates) | |
mydata$Month <- month(mydata$Dates) | |
mydata$Hour <- hour(mydata$Dates) |
library(statebins) | |
library(dplyr) | |
#get population data from https://www.census.gov/popest/data/national/totals/2015/files/NST-EST2015-popchg2010_2015.csv | |
pop<-read.csv("NST.csv", header = TRUE, sep = ",", quote = "\"",dec = ".", fill = TRUE, comment.char = "") | |
#data wangling to get only states and cast as characters | |
pop15 <- select(pop, NAME, POPESTIMATE2015) | |
pop15s<-slice(pop15, 6:56) | |
pops<-rename(pop15s, c(NAME=state,POPESTIMATE2015=pop)) |
library(statebins) | |
library(dplyr) | |
size<-read.csv("size.csv", header = TRUE, sep = ",", quote = "\"",dec = ".", fill = TRUE, comment.char = "") | |
i <- sapply(size, is.factor) | |
size[i] <- lapply(size[i], as.character) | |
sizeT <- mutate(size,areaT = round(area/1000)) | |
statebins_continuous(sizeT,value_col="areaT", text_color="black", font_size=3,legend_title = "50 States colored By Area", plot_title="US States Colored by 1000km squared",brewer_pal="PuRd", | |
legend_position="bottom",title_position="top") | |
csv is |
This is a Sankey graph made using d3.js to show how votes transfer in the Irish General Election February 2016
#Download data from http://www.met.ie/climate-request/ | |
# select the ddhm and the date columns. | |
data =read.csv("Dub2014.csv", header=TRUE) | |
newdata <- na.omit(data) | |
ggplot(aes(ddhm)) + | |
geom_histogram(binwidth = 10, colour = "blue")+ | |
theme_minimal() + | |
coord_polar(start = 0) + | |
scale_fill_brewer() + ylab("Wind Direction")+ xlab("ddhm: - Mean Wind Direction")+ |
<!DOCTYPE html> | |
<!-- paulirish.com/2008/conditional-stylesheets-vs-css-hacks-answer-neither/ --> | |
<!--[if lt IE 7 ]> <html lang="en" class="no-js ie6"> <![endif]--> | |
<!--[if IE 7 ]> <html lang="en" class="no-js ie7"> <![endif]--> | |
<!--[if IE 8 ]> <html lang="en" class="no-js ie8"> <![endif]--> | |
<!--[if IE 9 ]> <html lang="en" class="no-js ie9"> <![endif]--> | |
<!--[if (gt IE 9)|!(IE)]><!--> <html lang="en" class="no-js"> <!--<![endif]--> | |
<head> | |
<meta charset="utf-8"> |
# library documentation at https://cran.r-project.org/web/packages/LindenmayeR/LindenmayeR.pdf | |
# L systems described here at https://en.wikipedia.org/wiki/L-system | |
#variables : X Y | |
#start : FX | |
#rules : (X → X+YF+), (Y → −FX−Y) | |
#constants : F + − | |
#angle : 90° | |
# This doesnt work | |
library(LindenmayeR) | |
rSierp <- data.frame(inp = c("X", "Y"), out = c("X+YF+", "-FX−Y"), stringsAsFactors = FALSE) |