cs_crime can be used to easily identify crimes based on a 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.

cs_crime(.data, var, newVar, crime)

Arguments

.data

A tibble or data frame

var

Name of variable with 5 or 6 digit crime codes

newVar

Name of output variable to be created with logical data

crime

A string describing the crime type to be identified

Value

A copy of the object with a logical vector that is TRUE if the given crime matches the category given in the function.

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

Examples

# load example data testData <- january2018 # add logical vector for violent crimes testData <- cs_crime(testData, var = crime, newVar = violentCrimes, crime = "violent")