
Jo-fai Chow (University of Exeter & XP Solutions)
Final Year EngD Candidate in Hydroinformatics (Water + Machine Learning)
Download crime data within a 1 mile radius of a single point (JSON)
http://data.police.uk/api/
crimes-street/all-crime?
lat=52.629729&
lng=-1.131592&
date=2012-04
{"category" : "anti-social-behaviour",
"month" : "2012-04",
"location" : {
"latitude" : "52.640374",
"longitude" : "-1.122319",
"street" : {
"id" : 884330,
"name" : "On or near Christow Street"}},
... and some other stuff}
Specific area (JSON) and batch download (CSV).
crimeplot.wrapper <- function(
## user-defined location
point.of.interest = "London Eye",
## period of time in YYYY-MM
period = c("2013-01","2013-02",
"2013-03","2013-04"),
## terrain, satellite, hybrid
type.map = "roadmap",
## month, category, type
type.facet = NA
...)
"Shiny makes it super simple for R users like you to turn analyses into interactive web applications that anyone can use." - RStudio
"ShinyApps is a platform as a service (PaaS) for hosting Shiny applications ... allowing you to create your online account, and deploy your first Shiny application to the cloud." - RStudio
"It looks fun! Maybe I can learn a new trick!"
"Can I make it super user-friendly ... so easy that even my mom knows how to use it?"
"Is it really possible? I have NO prior web app development experience at all."
"Will it work on mobile devices?"
setAccountInfo(name = "blenditbayes",
token = "your_token",
secret = "your_secret")
deployApp(appDir = "your_app_dir",
appName = "your_app_name")
configureApp(appName = "crimemap",
size = "xlarge")
require(devtools)
install.packages(c("ggmap", "rjson",
"dplyr"))
install_github('ramnathv/rCharts@dev')
install_github('ramnathv/rMaps')
install_github('woobe/rCrimemap')
rcmap(
location = "Ball Brothers EC3R 7PP",
period = "2014-01",
type = "All",
map_size = c(1000, 500),
provider = "Nokia.normalDay",
zoom = 10)
require(rCrimemap); rcmap("Ball Brothers EC3R 7PP");
# [rCrimemap]: Downloading '2010-12.rda' from author's Bitbucket account ...
# [rCrimemap]: Converting raw data into JSON format for Leaflet ...
# [rCrimemap]: Creating Leaflet with Heat Map ...
# [rCrimemap]: =======================================================
# [rCrimemap]: Summary of Crime Data Used and Leaflet Map
# [rCrimemap]: =======================================================
# Point of Interest : Ball Brothers EC3R 7PP
# Police Force(s) : Metropolitan Police Service City of London Police
# Period of Crime Records : 2010-12
# Type of Crime Records : All
# Total No. of Crime Records : 93077
# Map Resolution : 1000 x 500
rcmap("Ball Brothers EC3R 7PP",
"2011-08", "All", c(1000,1000),
"Nokia.normalDay")
rcmap("Manchester",
"2014-01", "All", c(1000,1000),
"MapQuestOpen.OSM")
Thanks | For |
---|---|
Coursera & Jeff Leek |
Data Analysis Online Course |
David Kahle & Hadley Wickham |
ggmap and ggplot2 |
data.police.uk |
Open Crime Data and API |
RStudio Team (esp. Tareef Kawaf) |
RStudio IDE, Shiny & ShinyApps |
Chris Beeley & Packt |
For the Shiny Cookbook |
Ramnath Vaidyanathan |
Slidify, rCharts and rMaps |
... and, most importantly, of course ...Mango Solutions |
... kindly sponsoring and supportingLondonR since 2009! |
Other Stuff | URL |
---|---|
CrimeMap |
bit.ly/bib_crimemap |
CrimeMap Codes on GitHub | bit.ly/github_crimemap |
rCrimemap |
bit.ly/rCrimemap |
GitHub |
bit.ly/github_woobe |
Via | URL |
---|---|
Blog |
bit.ly/blenditbayes |
@matlabulous |
|
jofai.chow@gmail.com |
|
bit.ly/linkedin_jofaichow |
|
AboutMe |
bit.ly/aboutme_jofaichow |