Skip to content

Instantly share code, notes, and snippets.

<!doctype HTML>
<meta charset = 'utf-8'>
<html>
<head>
<link rel='stylesheet' href='http://timelyportfolio.github.io/rCharts_rpart/css/treestyle.css'>
<script src='http://d3js.org/d3.v3.min.js' type='text/javascript'></script>
<style>
.rChart {
@AnotherContext
AnotherContext / index.html
Created September 28, 2014 17:06
DA: area comparison based on assaults, with region filter
<!doctype HTML>
<meta charset = 'utf-8'>
<html>
<head>
<link rel='stylesheet' href="http://netdna.bootstrapcdn.com/bootstrap/3.0.3/css/bootstrap.min.css">
<link rel='stylesheet' href='http://nvd3.org/assets/css/nv.d3.css'>
<script src='http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js' type='text/javascript'></script>
<script src='http://d3js.org/d3.v3.min.js' type='text/javascript'></script>
<script src='http://timelyportfolio.github.io/rCharts_nvd3_tests/libraries/widgets/nvd3/js/nv.d3.min-new.js' type='text/javascript'></script>
@AnotherContext
AnotherContext / index.html
Created September 28, 2014 15:54
Domestic abuse: assault by region comparison
<!doctype HTML>
<meta charset = 'utf-8'>
<html>
<head>
<link rel='stylesheet' href='http://nvd3.org/assets/css/nv.d3.css'>
<script src='http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js' type='text/javascript'></script>
<script src='http://d3js.org/d3.v3.min.js' type='text/javascript'></script>
<script src='http://timelyportfolio.github.io/rCharts_nvd3_tests/libraries/widgets/nvd3/js/nv.d3.min-new.js' type='text/javascript'></script>
<script src='http://nvd3.org/assets/lib/fisheye.js' type='text/javascript'></script>
@AnotherContext
AnotherContext / index.html
Created September 28, 2014 15:32
DA: calls4assistance and crimes vs regions heatmap
<!doctype HTML>
<meta charset = 'utf-8'>
<html>
<head>
<script src='http://ramnathv.github.io/rCharts/libraries/widgets/polycharts/js/polychart2.standalone.js' type='text/javascript'></script>
<style>
.rChart {
display: block;
@AnotherContext
AnotherContext / index.html
Created September 28, 2014 15:27
DA: calls4assistance and crimes vs areas heatmap
<!doctype HTML>
<meta charset = 'utf-8'>
<html>
<head>
<link rel='stylesheet' href="http://netdna.bootstrapcdn.com/bootstrap/3.0.3/css/bootstrap.min.css">
<script src='http://ramnathv.github.io/rCharts/libraries/widgets/polycharts/js/polychart2.standalone.js' type='text/javascript'></script>
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.2.6/angular.min.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/lodash.js/2.4.1/lodash.min.js"></script>
@AnotherContext
AnotherContext / DA_AreaVsCalls.R
Last active August 29, 2015 14:06
Domestic abuse: area comparison based on assistance calls with region filter
#cont. DA_RegionVsCalls.R
###~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
### 2 area based on region filter
###~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
da2_data <- melt(da1, id= c("Area.Name", "Region.Name")) #variable, value
da2_plot <- as.data.frame(da2_data)
#x axis - region, option- variable
p2.1a <- nPlot(value ~ Area.Name, group = 'variable',
@AnotherContext
AnotherContext / DA_RegionVsCalls.R
Last active August 29, 2015 14:06
Domestic abuse: regions by assistance calls comparison
#continuation of DA_CallsVsRegion.R
p1.2a <- nPlot(value ~ variable, group = 'Region.Name',
data = da1_data,
type = 'multiBarChart'
)
p1.2a$set(dom = 'chart2', width = 1000)
p1.2a
#p1.2a$publish('Domestic abuse: regions by assistance calls comparison',host='gist')
@AnotherContext
AnotherContext / DA_CallsVsRegion.R
Last active August 29, 2015 14:06
Domestic abuse: assistance calls by region comparison
dom_abuse <- read.csv(file = "domestic_abuse.csv")
#names(dom_abuse)
da1 <- dom_abuse[c("Area.Name", "Region.Name", "Number.of.calls.for.assistance", "Total.crime", "calls.for.assistance.with.DA.marker", "crime.with.a.DA.marker" )]
#head(da1)
#col names
#[1] "Area.Name"
#[2] "Region.Name"
###~~~~~~~~~~~~~~~~~~~~~~~