Prof Chris Brunsdon
National Centre for Geocomputation
MUSSI
Maynooth UniversitySeptember 22nd, 2022
R is a system for statistical computation and graphics. It provides, among other things, a programming language, high level graphics, interfaces to other languages and software tools and debugging facilities.
Versions exist for
A number of packages can be added to R to extend its functionality. Notably:
Nothing.
R is available as Free Software under the terms of the Free Software Foundation’s GNU General Public License in source code form.
Tip
This also means the code used to create R and all of its packages are Open Source, so all code used is open to scrutiny.
Weapons Violations January 2022
Sources:
# Load Libraries
library(tmap)
library(sf)
library(tidyverse)
library(RSocrata)
library(glue)
# Pull data and process it
stem <- "https://data.cityofchicago.org/resource/9hwr-2zxp.json"
query <- "date between '2022-01-01T00:00:00' and '2022-02-01T00:00:00'"
wv <- read.socrata(glue("{stem}?$where={query}")) %>%
as_tibble() %>%
filter(primary_type=="WEAPONS VIOLATION") %>%
st_as_sf(coords=c(21,9),crs=4326)
# Make interactive map
tmap_mode('view')
tm_shape(wv) + tm_dots(col='arrest')
R is a hub as well as a data processor:
Hotspots
Chance of Arrest
spatstat
and sf
handle point data sets differentlysf
Thank You