Learn R Programming

crimelinkage (version 0.0.3)

compareCrimes: Creates evidence variables by calculating distance between crime pairs

Description

Calculates spatial and temporal distance, difference in categorical, and absolute value of numerical crime variables

Usage

compareCrimes(Pairs, crimedata, varnames, binary = TRUE, longlat = FALSE,
  show.pb = FALSE, seed = NULL)

Arguments

Pairs
(n x 2) matrix of crimeIDs
crimedata
data.frame of crime incident data. crimedata must have a column named: crimeID. Other column names must correspond to what is given in varnames list.
varnames
list of column names corresponding to:
  • spatial - X,Y coordinates (in long,lat or X,Y)
  • temporal - DT.FROM, DT.TO
  • categorical - (optional) any categorical variables
  • numerical - (optional) any numeric variables
binary
(logical) match/no match or all combinations for categorical class
longlat
(logical) are spatial coordinates in (long,lat)?
show.pb
(logical) show the progress bar
seed
seed for random number generation

Value

  • data.frame of various proximity measures between the two crimes

References

Porter, M. D. (2014). A Statistical Approach to Crime Linkage. arXiv preprint arXiv:1410.2285.. http://arxiv.org/abs/1410.2285

Examples

Run this code
data(crimes)

 varnames = list(
   spatial = c("X", "Y"),
   temporal = c("DT.FROM","DT.TO"),
   categorical = c("MO1",  "MO2", "MO3"))
 pairs = t(combn(as.character(crimes$crimeID[1:4]),m=2))

 compareCrimes(pairs,crimes,varnames,binary=TRUE)

Run the code above in your browser using DataLab