njtr1 is a package that makes it easy to download New Jersey car crash data that is released by the New Jersey Department of Transportation. This package makes it easy to access detailed information on a statewide or county-by-county process that can assist those interested in studying trends in vehicle crashes in New Jersey.

Usage

The main function of this package is get_njtr1(). This function allows you to specify the specific table of NJTR-1 data that you'd like to query for a given year.

There are 5 different tables available with NJTR-1 data and published by the NJDOT. We will take a look at each of them in the following examples.

Accidents

get_njtr1(year = 2019, type = "Accidents")
## # A tibble: 283,210 x 50
##    id    county_name municipality_na~ crash_date crash_day_of_we~ crash_time
##    <chr> <chr>       <chr>            <chr>      <chr>            <chr>     
##  1 2019~ ATLANTIC    ABSECON CITY     02/14/2019 TH               1005      
##  2 2019~ ATLANTIC    ABSECON CITY     01/28/2019 MO               0953      
##  3 2019~ ATLANTIC    ABSECON CITY     01/01/2019 TU               0853      
##  4 2019~ ATLANTIC    ABSECON CITY     01/02/2019 WE               2200      
##  5 2019~ ATLANTIC    ABSECON CITY     01/09/2019 WE               1253      
##  6 2019~ ATLANTIC    ABSECON CITY     01/11/2019 FR               0855      
##  7 2019~ ATLANTIC    ABSECON CITY     01/11/2019 FR               1110      
##  8 2019~ ATLANTIC    ABSECON CITY     01/13/2019 SU               1007      
##  9 2019~ ATLANTIC    ABSECON CITY     01/16/2019 WE               2000      
## 10 2019~ ATLANTIC    ABSECON CITY     01/18/2019 FR               1738      
## # ... with 283,200 more rows, and 44 more variables: police_dept_code <chr>,
## #   police_department <chr>, police_station <chr>, total_killed <dbl>,
## #   total_injured <dbl>, pedestrians_killed <dbl>, pedestrians_injured <dbl>,
## #   severity <chr>, intersection <chr>, alcohol_involved <chr>,
## #   hazmat_involved <chr>, crash_type_code <chr>,
## #   total_vehicles_involved <dbl>, crash_location <chr>,
## #   location_direction <chr>, route <dbl>, route_suffix <dbl>,
## #   sri_std_rte_identifier <chr>, milepost <dbl>, road_system <chr>,
## #   road_character <lgl>, road_horizontal_alignment <chr>, road_grade <chr>,
## #   road_surface_type <chr>, surface_condition <chr>, light_condition <chr>,
## #   environmental_condition <chr>, road_divided_by <chr>,
## #   temporary_traffic_control_zone <chr>, distance_to_cross_street <dbl>,
## #   unit_of_measurement <chr>, directn_from_cross_street <chr>,
## #   cross_street_name <chr>, is_ramp <lgl>, ramp_tofrom_route_name <chr>,
## #   ramp_tofrom_route_direction <chr>, posted_speed <dbl>,
## #   posted_speed_cross_street <dbl>, first_harmful_event <chr>, latitude <lgl>,
## #   longitude <lgl>, cell_phone_in_use_flag <chr>, other_property_damage <chr>,
## #   reporting_badge_no <chr>

Drivers

get_njtr1(year = 2019, type = "Drivers")
## # A tibble: 538,367 x 22
##    id    vehicle_number driver_city driver_state driver_zip_code
##    <chr>          <dbl> <chr>       <chr>        <chr>          
##  1 2019~              1 PLEASANTVI~ NJ           08232          
##  2 2019~              1 ATLANTIC C~ NJ           08401          
##  3 2019~              2 ABSECON     NJ           08201          
##  4 2019~              1 PLEASANTVI~ NJ           08232          
##  5 2019~              1 ABSECON     NJ           08201          
##  6 2019~              2 ABSECON     NJ           08201          
##  7 2019~              1 GALLOWAY    NJ           08205          
##  8 2019~              2 EGG HARBOR~ NJ           08234          
##  9 2019~              1 ATLANTIC C~ NJ           08401          
## 10 2019~              2 OCEAN CITY  NJ           08226          
## # ... with 538,357 more rows, and 17 more variables:
## #   driver_license_state <chr>, driver_dob <chr>, driver_sex <chr>,
## #   alcohol_test_given <chr>, alcohol_test_type <chr>,
## #   alcohol_test_results <dbl>, charge_1 <chr>, summons_1 <chr>,
## #   charge_2 <chr>, summons_2 <chr>, charge_3 <chr>, summons_3 <chr>,
## #   charge_4 <chr>, summons_4 <chr>, driver_physical_status_1 <lgl>,
## #   driver_physical_status_2 <chr>, NA <lgl>

Vehicles

get_njtr1(year = 2019, type = "Vehicles")
## # A tibble: 538,353 x 40
##    id    vehicle_number insurance_compa~ owner_state make_of_vehicle
##    <chr>          <dbl> <chr>            <chr>       <chr>          
##  1 2019~              1 134              NJ          HONDA          
##  2 2019~              1 411              NJ          VOLKSWAGEN     
##  3 2019~              2 134              NJ          JEEP           
##  4 2019~              1 <NA>             NJ          MERCURY        
##  5 2019~              1 135              NJ          NISSAN         
##  6 2019~              2 963              NJ          BUICK          
##  7 2019~              1 148              NJ          FORD           
##  8 2019~              2 054              NJ          LEXUS          
##  9 2019~              1 487              NJ          CHEVROLET      
## 10 2019~              2 148              NJ          TOYOTA         
## # ... with 538,343 more rows, and 35 more variables: model_of_vehicle <chr>,
## #   color_of_vehicle <chr>, year_of_vehicle <dbl>, license_plate_state <chr>,
## #   vehicle_weight_rating <dbl>, towed <lgl>, removed_by <dbl>,
## #   drivenleft_at_scenetowed <dbl>, initial_impact_location <chr>,
## #   principal_damage_location <chr>, extent_of_damage <chr>,
## #   traffic_controls_present <chr>, vehicle_type <chr>, vehicle_use <chr>,
## #   special_function_vehicles <chr>, cargo_body_type <chr>,
## #   contributing_circumstances_1 <chr>, contributing_circumstances_2 <chr>,
## #   direction_of_travel <chr>, precrash_action <chr>,
## #   first_sequence_of_events <chr>, second_sequence_of_events <chr>,
## #   third_sequence_of_events <chr>, fourth_sequence_of_events <chr>,
## #   most_harmful_event <chr>, oversizeoverweight_permit <chr>,
## #   hazmat_status <lgl>, hazmat_class <lgl>, hazmat_placard <lgl>,
## #   usdot_number <chr>, mcmx_number <dbl>, usdot__other_flag <lgl>,
## #   usdot__other_number <lgl>, carrier_name <chr>, hit__run_driver_flag <chr>

Insurance company data

Each of the vehicle records contain a field name insurance_company_code that identifies the name of the insurance company that covers the vehicle involved in an accident.

This code can be used to join the vehicle data with a dataset containing details for every insurance company that does business in New Jersey.

Access the insurance from the package like so:

data("insurance")
head(insurance)
## # A tibble: 6 x 9
##   ID_NO NAME         ADDRESS_1    ADDRESS_2 ADDRESS_3 CITY   STATE ZIP   NOTES  
##   <chr> <chr>        <chr>        <chr>     <chr>     <chr>  <chr> <chr> <chr>  
## 1 001   SAMSUNG FIR~ 25 CHALLENG~ <NA>      <NA>      RIDGE~ NJ    07660 COMM O~
## 2 002   BROTHERHOOD~ PO BOX 2227  <NA>      <NA>      FORT ~ IN    07661 COMM O~
## 3 003   MID-CENTURY~ 4680 WILSHI~ <NA>      <NA>      LOS A~ CA    07662 PRIV P~
## 4 004   ACE PROPERT~ 1601 CHESTN~ PO BOX 4~ <NA>      PHILA~ PA    07663 COMM O~
## 5 005   FIRST NONPR~ 111 NORTH C~ SUITE 801 <NA>      CHICA~ IL    07664 COMM O~
## 6 006   EVEREST PRE~ 477 MARTINS~ <NA>      <NA>      LIBER~ NJ    07665 COMM O~

The insurance dataset contains a field ID_NO which is the same as insurance_company_code in the Vehicles table. This common field can be used for performing join operations.

Pedestrians

get_njtr1(year = 2019, type = "Pedestrians")
## # A tibble: 7,946 x 35
##    id    pedestrian_numb~ physical_condit~ address_city address_state
##    <chr>            <dbl> <chr>            <chr>        <chr>        
##  1 2019~                1 02               PLEASANTVIL~ NJ           
##  2 2019~                1 04               ABSECON      NJ           
##  3 2019~                1 03               GALLOWAY     NJ           
##  4 2019~                1 01               LINDENWOLD   NJ           
##  5 2019~               31 <NA>             TUCKERTON    NJ           
##  6 2019~                1 03               ABSECON      NJ           
##  7 2019~                1 02               EGG HARBOR ~ NJ           
##  8 2019~                1 02               EGG HARBOR ~ NJ           
##  9 2019~                1 03               ABSECON      NJ           
## 10 2019~                1 02               ABSECON      NJ           
## # ... with 7,936 more rows, and 30 more variables: address_zip <chr>,
## #   date_of_birth <chr>, age <chr>, sex <chr>, alcohol_test_given <chr>,
## #   alcohol_test_type <chr>, alcohol_test_results <lgl>, charge_1 <chr>,
## #   summons_1 <chr>, charge_2 <chr>, summons_2 <chr>, charge_3 <lgl>,
## #   summons_3 <lgl>, charge_4 <chr>, summons_4 <chr>, multi_charge_flag <lgl>,
## #   traffic_controls <chr>, contributing_circumstances_1 <chr>,
## #   contributing_circumstances_2 <chr>, direction_of_travel <chr>,
## #   precrash_action <chr>, location_of_most_severe_injury <chr>,
## #   type_of_most_severe_phys_injury <chr>, refused_medical_attention <chr>,
## #   safety_equipment_used <chr>, hospital_code <dbl>, physical_status_1 <chr>,
## #   physical_status_2 <chr>, is_bycyclist <chr>, is_other <lgl>

Occupants

get_njtr1(year = 2019, type = "Occupants")
## # A tibble: 651,507 x 15
##    id    vehicle_number occupant_number physical_condit~ position_in_on_~
##    <chr>          <dbl>           <dbl> <chr>            <chr>           
##  1 2019~              1               1 <NA>             01              
##  2 2019~              1               1 04               01              
##  3 2019~              1               2 <NA>             06              
##  4 2019~              2               3 04               01              
##  5 2019~              1               1 <NA>             01              
##  6 2019~              1               1 04               01              
##  7 2019~              1               2 04               03              
##  8 2019~              2               3 04               01              
##  9 2019~              2               4 04               03              
## 10 2019~              2               5 <NA>             06              
## # ... with 651,497 more rows, and 10 more variables: ejection_code <chr>,
## #   age <chr>, sex <chr>, location_of_most_severe_injury <chr>,
## #   type_of_most_severe_phys_injury <chr>, refused_medical_attention <chr>,
## #   safety_equipment_available <chr>, safety_equipment_used <chr>,
## #   airbag_deployment <chr>, NA <dbl>