R/make_sps/nibrs_offense_segment_sps.R

source(here::here('R/make_sps/make_sps_utils.R'))
source(here::here('R/make_sps/nibrs_sps_utils.R'))
# Page 46-53

col_positions <- c("1-2",
                   "3-4",
                   "5-13",
                   "14-25",
                   "26-33",
                   "34-36",
                   "37",
                   "38",
                   "39",
                   "40",
                   "41-42",
                   "43-44",
                   "45",
                   "46",
                   "47",
                   "48",
                   "49-50",
                   "51",
                   "52-53",
                   "54",
                   "55-56",
                   "57",
                   "58-59")

col_labels <- c("segment_level",
                "state",
                "ori",
                "incident_number",
                "incident_date",
                "ucr_offense_code",
                "offense_attempted_or_completed",
                "offender_suspected_of_using_1",
                "offender_suspected_of_using_2",
                "offender_suspected_of_using_3",
                "location_type",
                "number_of_premises_entered",
                "method_of_entry",
                "type_criminal_activity_1",
                "type_criminal_activity_2",
                "type_criminal_activity_3",
                "type_weapon_force_involved_1",
                "automatic_weapon_indicator_1",
                "type_weapon_force_involved_2",
                "automatic_weapon_indicator_2",
                "type_weapon_force_involved_3",
                "automatic_weapon_indicator_3",
                "bias_motivation")



nibrs_offense_segment_value_labels_repeated <-
  c("offender_suspected_of_using_replace = ",
    "A = alcohol",
    "C = computer equipment",
    "D = drugs/narcotics",
    "N = not applicable",
    "type_criminal_activity_replace = ",
    "A = simple/gross neglect (unintentionally, intentionally, or knowingly failing to provide food, water, shelter, veterinary care, hoarding, etc.)",
    "B = buying/receiving",
    "C = cultivating/manufacturing/publishing",
    "D = distributing/selling",
    "E = exploiting children",
    "O = operating/promoting/assisting",
    "P = possessing/concealing",
    "T = transporting/transmitting/importing",
    "U = using/consuming",
    "I = intentional abuse and torture (tormenting, mutilating, poisoning, or abandonment)",
    "S = animal sexual abuse (bestiality)",
    "F = organized abuse (dog fighting and cock fighting)",
    # From NACJD 2016 offense segment file
    "N = none/unknown gang involvement (mutually exclusive)",
    "G = other gang",
    "J = juvenile gang involvement",
    "type_weapon_force_involved_replace = ",
    "11 = firearm (type not stated)",
    "12 = handgun",
    "13 = rifle",
    "14 = shotgun",
    "15 = other firearm",
    "20 = knife/cutting instrument (ice pick, screwdriver, ax, etc.)",
    "30 = blunt object (club, hammer, etc.)",
    "35 = motor vehicle",
    "40 = personal weapons (hands, feet, teeth, etc.)",
    "50 = poison (include gas)",
    "60 = explosives",
    "65 = fire/incendiary device",
    "70 = drugs/narcotics/sleeping pills",
    "85 = asphyxiation (by drowning, strangulation, suffocation, gas, etc.)",
    "90 = other",
    "95 = unknown",
    "99 = none",
    "automatic_weapon_indicator_replace = ",
    "A = automatic weapon")
nibrs_offense_segment_value_labels_repeated <-
  repeated_label_replace_fixer(nibrs_offense_segment_value_labels_repeated,
                               1:3)

nibrs_offense_segment_value_labels <-
  c(state_value_labels,
    "offense_attempted_or_completed = ",
    "A = attempted",
    "C = completed",
    "bias_motivation = ",
    "11 = anti-white",
    "12 = anti-black",
    "13 = anti-american indian or alaskan native",
    "14 = anti-asian",
    "15 = anti-multi-racial group",
    "21 = anti-jewish",
    "22 = anti-catholic",
    "23 = anti-protestant",
    "24 = anti-islamic (muslim)",
    "25 = anti-other religion",
    "26 = anti-multi-religious group",
    "27 = anti-atheism/agnosticism",
    "31 = anti-arab",
    "32 = anti-hispanic",
    "33 = anti-other race/ethnicity/national origin",
    "41 = anti-gay (male)",
    "42 = anti-lesbian (female)",
    "43 = anti-lesbian, gay, bisexual, or transgender (mixed group)",
    "44 = anti-heterosexual",
    "45 = anti-bisexual",
    "88 = no bias motivation",
    "99 = unknown bias motivation",
    # From NACJD 2016 offense segment file
    "16 = anti-native hawaiian or other pacific islander",
    "28 = anti-mormon",
    "29 = anti-jehovahs witness",
    "51 = anti-physical disability",
    "52 = anti-mental disability",
    "61 = anti-male",
    "62 = anti-female",
    "71 = anti-transgender",
    "72 = anti-gender non-conforming",
    "81 = anti-eastern orthodox (greek, russian, etc.)",
    "82 = anti-other christian",
    "83 = anti-buddhist",
    "84 = anti-hindu",
    "85 = anti-sikh",
    "method_of_entry = ",
    "F = force",
    "N = no force",
    location_type_value_labels,
    ucr_offense_code_value_labels,
    nibrs_offense_segment_value_labels_repeated)

setwd(here::here("setup_files"))
make_sps_setup(file_name = "nibrs_offense_segment",
               col_positions = col_positions,
               col_labels    = col_labels,
               value_labels  = nibrs_offense_segment_value_labels)
jacobkap/crime_data documentation built on April 16, 2023, 11:58 p.m.