cs_filter_crime: Filter Crimes

Description Usage Arguments Details Value Examples

View source: R/filter.R

Description

cs_filter_crime can be used to subset based on specific single UCR categories or common groupings. This can be used on any police department's data where codes like 31111 (robbery with a firearm) or 142320 (malicious destruction of property) are used to identify crimes.

Usage

1
cs_filter_crime(.data, var, crime)

Arguments

.data

A tibble or data frame

var

Name of variable with 5 or 6 digit crime codes

crime

A string describing the crime type to be identified

Details

The categories used here are derived from the U.S. Federal Bureau of Investigation's Uniform Crime Reporting codes. Valid inputs for the crime argument are as follows:

"violent"

Violent crimes (homicide, rape, aggravated assault, and robbery)

"property"

Property crimes (burglary, larceny, larceny of a motor vehicle, and arson)

"part 1"

All violent and property crimes

"homicide"

"murder" is also acceptable as input as is UCR code 1

"rape"

"forcible rape" is also acceptable as input as is UCR code 2

"robbery"

UCR code 3 is also acceptable input

"agg assualt"

"aggravated assualt" is also acceptable as input as is UCR code 4

"burglary"

UCR code 5 is also acceptable input

"larceny-theft"

"larceny" and "theft" are also acceptable inputs as is UCR code 6

"mv theft"

"motor vehicle theft", "motor vehicle larceny", and "mv larceny" are also acceptable inputs as input as is UCR code 7

"arson"

UCR code 8 is also acceptable input

"part 2"

All other crimes

"assault"

"other assaults" is also acceptable input as is UCR code 9

"forgery"

"forgery and counterfeiting" is also acceptable input as is UCR code 10

"fraud"

UCR code 11 is also acceptable input

"embezzlement"

UCR code 12 is also acceptable input

"stolen prop"

"stolen property" is also acceptable input as is UCR code 13

"vandalism"

UCR code 14 is also acceptable input

"weapons"

UCR code 15 is also acceptable input

"prostitution"

"prostitution and commercialized vice" is also acceptable input as is UCR code 16

"sex offenses"

UCR code 17 is also acceptable input

"drugs"

"drug abuse violations" is also acceptable input as is UCR code 18

"gambling"

UCR code 19 is also acceptable input

"family"

"offenses against the family and children" is also acceptable input as is UCR code 20

"dwi"

"driving under the influence" is also acceptable input as is UCR code 21

"liquor laws"

UCR code 22 is also acceptable input

"drunkenness"

UCR code 23 is also acceptable input

"discon"

"disorderly conduct" is also acceptable input as is UCR code 24

"vagrancy"

UCR code 25 is also acceptable input

"other"

"all other offenses" is also acceptable input as is UCR code 26

"suspicion"

UCR code 27 is also acceptable input

"curfew"

"curfew and loitering laws-persons under 18" is also acceptable input as is UCR code 28

"runaway"

"runaways-persons under 18" is also acceptable input as is UCR code 29

Value

A subset object with only the specified crimes

Examples

1
2
3
4
5
# load example data
testData <- january2018

# subset data to retain only violent crimes
testData <- cs_filter_crime(testData, var = crime, crime = "violent")

compstatr documentation built on July 8, 2020, 7:34 p.m.