Learn R Programming

crimelinkage (version 0.0.4)

makeSeriesData: Make crime series data

Description

Creates a data frame with index to crimedata and offender information. It is used to generate the linkage data.

Usage

makeSeriesData(crimedata, offenderTable, time = c("midpoint", "earliest", "latest"))

Arguments

crimedata
data.frame of crime incident data. crimedata must have columns named: crimeID, DT.FROM, and DT.TO. Note: if crime timing is known exactly (uncensored) than only DT.FROM is required.
offenderTable
offender table that indicates the offender(s) responsible for solved crimes. offenderTable must have columns named: offenderID and crimeID.
time
the event time to be returned: 'midpoint', 'earliest', or 'latest'

Value

data frame representation of the crime series present in the crimedata. It includes the crime ID (crimeID), index of that crimeID in the original crimedata (Index), the crime series ID (CS) corresponding to each offenderID, and the event time (TIME).

Details

The creates a crimeseries data object that is required for creating linkage data. It creates a crime series ID (CS) for every offender. Because of co-offending, a single crime (crimeID) can belong to multiple crime series.

See Also

getCrimeSeries

Examples

Run this code
data(crimes)
 data(offenders)

 seriesData = makeSeriesData(crimedata=crimes,offenderTable=offenders)
 head(seriesData)

 nCrimes = table(seriesData$offenderID)  # length of each crime series
 table(nCrimes)                  # distribution of crime series length
 mean(nCrimes>1)                 # proportion of offenders with multiple crimes

 nCO = table(seriesData$crimeID) # number of co-offenders per crime
 table(nCO)                      # distribution of number of co-offenders
 mean(nCO>1)                     # proportion of crimes with multiple co-offenders

Run the code above in your browser using DataLab