A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/s87jackson/rfars below:

s87jackson/rfars: Download raw data from the Fatality Analysis Reporting System and prepare it for research.

The goal of rfars is to facilitate transportation safety analysis by simplifying the process of extracting data from official crash databases. The National Highway Traffic Safety Administration collects and publishes a census of fatal crashes in the Fatality Analysis Reporting System and a sample of fatal and non-fatal crashes in the Crash Report Sampling System (an evolution of the General Estimates System). The Fatality and Injury Reporting System Tool allows users to query these databases, and can produce simple tables and graphs. This suffices for simple analysis, but often leaves researchers wanting more. Digging any deeper, however, involves a time-consuming process of downloading annual ZIP files and attempting to stitch them together - after first combing through immense data dictionaries to determine the required variables and table names.

rfars allows users to download FARS and GES/CRSS data back to 2011 with just one line of code. The result is a full, rich dataset ready for mapping, modeling, and other downstream analysis. Helper functions are also provided to produce common counts and comparisons.

# install.packages("devtools")
devtools::install_github("s87jackson/rfars")
install.packages("rfars")
library(rfars)
library(dplyr)

The get_fars() and get_gescrss() are the primary functions of the rfars package. These functions either download and process data files directly from NHTSA’s FTP Site, or pull the prepared file stored on your local machine. They take the functions years and states (FARS) or regions (GES/CRSS). As the source data files follow an annual structure, years determines how many file sets are downloaded, and states/regions filters the resulting dataset. Downloading and processing these files can take several minutes. Before downloading rfars will inform you that it’s about to download files and asks your permission to do so. To skip this dialog, set proceed = TRUE. You can use the dir and cache parameters to save an RDS file to your local machine. The dir parameter specifices the directory, and cache names the file (be sure to include the .rds file extension).

myFARS <- get_fars(years = 2023, states = "VA", proceed = TRUE)
#> ✓ 2023 data downloaded
#> Preparing raw data files...
#> ✓ Accident file processed
#> ✓ Vehicle file processed
#> ✓ Person file processed
#> ✓ Weather file(s) processed
#> ✓ Crash risk factors file processed
#> ✓ Vehicle-level files processed
#> ✓ PBtype file processed
#> ✓ SafetyEq file processed
#> ✓ Person-level files processed
#> ✓ Flat file constructed
#> ✓ Multi_acc file constructed
#> ✓ Multi_veh file constructed
#> ✓ Multi_per file constructed
#> ✓ SOE file constructed
#> ✓ Prepared files saved in C:/Users/STEVEJ~1/AppData/Local/Temp/Rtmp86XeJ3/FARS data/prepd/2023
#> ✓ Codebook file saved in C:/Users/STEVEJ~1/AppData/Local/Temp/Rtmp86XeJ3/FARS data/prepd/
myFARS <- get_fars(years=2023, states = "VA", proceed = TRUE, dir = getwd(), cache = "myFARS.rds")

Note that you can assign and save this data with one function call.

We could similarly get one year of CRSS data for the south (MD, DE, DC, WV, VA, KY, TN, NC, SC, GA, FL, AL, MS, LA, AR, OK, TX):

myCRSS <- get_gescrss(years = 2023, regions = "s", proceed = TRUE)
myCRSS <- get_gescrss(years = 2023, regions = "s", proceed = TRUE, dir = getwd(), cache = "myCRSS.rds")

The data returned by get_fars() and get_gescrss() adhere to the same structure: a list with six tibbles: flat, multi_acc, multi_veh, multi_per, events, and codebook. FARS and GES/CRSS share many but not all data elements. See the FARS Analytical User’s Manual and CRSS Analytical User’s Manual for more information.

The following section decribes the results from get_fars() but largely applies to get_gescrss() as well.

The flat tibble contains all variables for which there is just one value per crash (“accident”), vehicle, or person (e.g., intersection type, travel speed, age). Each row corresponds to a person involved in a crash. As there may be multiple people and/or vehicles involved in one crash, some variable-values are repeated within a crash or vehicle. Each crash is uniquely identified with id, which is a combination of year and st_case. Note that st_case is not unique across years, for example, st_case 510001 will appear in each year. The id variable attempts to avoid this issue.

glimpse(myFARS$flat, width = 100)
#> Rows: 1,789
#> Columns: 196
#> $ year          <dbl> 2023, 2023, 2023, 2023, 2023, 2023, 2023, 2023, 2023, 2023, 2023, 2023, 2023…
#> $ state         <chr> "Virginia", "Virginia", "Virginia", "Virginia", "Virginia", "Virginia", "Vir…
#> $ st_case       <dbl> 510001, 510001, 510002, 510002, 510003, 510003, 510003, 510003, 510004, 5100…
#> $ id            <dbl> 2023510001, 2023510001, 2023510002, 2023510002, 2023510003, 2023510003, 2023…
#> $ veh_no        <dbl> 0, 1, 1, 2, 1, 1, 1, 2, 1, 1, 1, 1, 2, 3, 1, 1, 1, 2, 2, 2, 2, 2, 1, 2, 1, 2…
#> $ per_no        <dbl> 1, 1, 1, 1, 1, 2, 3, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 2, 3, 4, 5, 1, 1, 1, 1…
#> $ county        <dbl> 810, 810, 1, 1, 125, 125, 125, 125, 33, 710, 770, 199, 199, 199, 87, 87, 53,…
#> $ city          <dbl> 2540, 2540, 0, 0, 0, 0, 0, 0, 0, 1760, 2100, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0…
#> $ lon           <dbl> -76.03962, -76.03962, -75.55837, -75.55837, -78.93293, -78.93293, -78.93293,…
#> $ lat           <dbl> 36.63201, 36.63201, 37.87557, 37.87557, 37.70849, 37.70849, 37.70849, 37.708…
#> $ acc_config    <dbl> NA, 103, 401, 402, 502, 502, 502, 501, 102, 101, 998, 504, 503, 998, 102, 10…
#> $ age           <chr> "41 Years", "32 Years", "39 Years", "61 Years", "37 Years", "25 Years", "31 …
#> $ air_bag       <chr> "Not a Motor Vehicle Occupant", "Not Deployed", "Deployed- Combination", "No…
#> $ alc_res       <chr> "0.303 % BAC", "Test Not Given", "Test Not Given", "0.000 % BAC", "Test Not …
#> $ alc_status    <chr> "Test Given", "Test Not Given", "Test Not Given", "Test Given", "Test Not Gi…
#> $ arr_hour      <chr> "Unknown EMS Scene Arrival Hour", "Unknown EMS Scene Arrival Hour", "Unknown…
#> $ arr_min       <chr> "Unknown if Arrived", "Unknown if Arrived", "Unknown EMS Scene Arrival Minut…
#> $ atst_typ      <chr> "Vitreous", "Test Not Given", "Test Not Given", "Vitreous", "Test Not Given"…
#> $ bikecgp       <chr> "Not a Cyclist", NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,…
#> $ bikectype     <chr> "Not a Cyclist", NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,…
#> $ bikedir       <chr> "Not a Cyclist", NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,…
#> $ bikeloc       <chr> "Not a Cyclist", NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,…
#> $ bikepos       <chr> "Not a Cyclist", NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,…
#> $ body_typ      <chr> NA, "Medium/heavy Pickup (GVWR greater than 10,000 lbs.)", "Minivan (Chrysle…
#> $ bus_use       <chr> NA, "Not a Bus", "Not a Bus", "Not a Bus", "Not a Bus", "Not a Bus", "Not a …
#> $ cargo_bt      <chr> NA, "Van/Enclosed Box", "Not Applicable (N/A)", "Not Applicable (N/A)", "Not…
#> $ cdl_stat      <chr> NA, "No (CDL)", "No (CDL)", "No (CDL)", "No (CDL)", "No (CDL)", "No (CDL)", …
#> $ cityname      <chr> "VIRGINIA BEACH", "VIRGINIA BEACH", "NOT APPLICABLE", "NOT APPLICABLE", "NOT…
#> $ countyname    <chr> "VIRGINIA BEACH (CITY) (810)", "VIRGINIA BEACH (CITY) (810)", "ACCOMACK (1)"…
#> $ day           <dbl> 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 5, 6, 6, 6, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 7, 7…
#> $ day_week      <chr> "Sunday", "Sunday", "Sunday", "Sunday", "Monday", "Monday", "Monday", "Monda…
#> $ death_da      <chr> "1", "Not Applicable (Non-Fatal)", "Not Applicable (Non-Fatal)", "1", "Not A…
#> $ death_hr      <chr> "18:00-18:59", "Not Applicable (Non-fatal)", "Not Applicable (Non-fatal)", "…
#> $ death_mn      <chr> "10", "Not Applicable (Non-fatal)", "Not Applicable (Non-fatal)", "0", "Not …
#> $ death_mo      <chr> "January", "Not Applicable (Non-Fatal)", "Not Applicable (Non-Fatal)", "Janu…
#> $ death_tm      <chr> "1810", "Not Applicable (Non-fatal)", "Not Applicable (Non-fatal)", "1700", …
#> $ death_yr      <chr> "2023", "Not Applicable (Non-fatal)", "Not Applicable (Non-fatal)", "2023", …
#> $ deaths        <dbl> NA, 0, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 1, …
#> $ deformed      <chr> NA, "Not Reported", "Disabling Damage", "Disabling Damage", "Disabling Damag…
#> $ devmotor      <dbl> 0, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, N…
#> $ devtype       <dbl> 0, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, N…
#> $ doa           <chr> "Died at Scene", "Not Applicable", "Not Applicable", "Died at Scene", "Not A…
#> $ dr_drink      <chr> NA, "No", "No", "No", "No", "No", "No", "No", "Yes", "No", "Yes", "No", "No"…
#> $ dr_hgt        <chr> NA, "70", "63", "69", "59", "59", "59", "65", "72", "74", "72", "67", "72", …
#> $ dr_pres       <chr> NA, "Yes", "Yes", "Yes", "Yes", "Yes", "Yes", "Yes", "Yes", "Yes", "Yes", "Y…
#> $ dr_wgt        <chr> NA, "170 lbs.", "170 lbs.", "180 lbs.", "115 lbs.", "115 lbs.", "115 lbs.", …
#> $ dr_zip        <chr> NA, "23457", "23421", "23308", "24554", "24554", "24554", "24572", "20746", …
#> $ drinking      <chr> "Yes (Alcohol Involved)", "No (Alcohol Not Involved)", "No (Alcohol Not Invo…
#> $ drugs         <chr> "Reported as Unknown", "No (drugs not involved)", "No (drugs not involved)",…
#> $ dstatus       <chr> "Test Given", "Test Not Given", "Test Not Given", "Test Given", "Test Not Gi…
#> $ ej_path       <chr> "Ejection Path Not Applicable", "Ejection Path Not Applicable", "Ejection Pa…
#> $ ejection      <chr> "Not Applicable", "Not Ejected", "Not Ejected", "Not Applicable", "Not Eject…
#> $ emer_use      <chr> NA, "Not Applicable", "Not Applicable", "Not Applicable", "Not Applicable", …
#> $ extricat      <chr> "Not Extricated or Not Applicable", "Not Extricated or Not Applicable", "Not…
#> $ fatals        <dbl> 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1…
#> $ fire_exp      <chr> NA, "No or Not Reported", "No or Not Reported", "Yes", "No or Not Reported",…
#> $ first_mo      <chr> NA, "No Record", "No Record", "No Record", "March", "March", "March", "Septe…
#> $ first_yr      <chr> NA, "No Record", "No Record", "No Record", "2019", "2019", "2019", "2018", "…
#> $ func_sys      <chr> "Major Collector", "Major Collector", "Principal Arterial - Other", "Princip…
#> $ gvwr_from     <chr> NA, "Class 3: 10,001 - 14,000 lbs. (4,536 - 6,350 kg)", "Class 2: 6,001 - 10…
#> $ gvwr_to       <chr> NA, "Class 3: 10,001 - 14,000 lbs. (4,536 - 6,350 kg)", "Class 2: 6,001 - 10…
#> $ harm_ev       <chr> "Pedestrian", "Pedestrian", "Motor Vehicle In-Transport", "Motor Vehicle In-…
#> $ haz_cno       <chr> NA, "Not Applicable", "Not Applicable", "Not Applicable", "Not Applicable", …
#> $ haz_id        <chr> NA, "Not Applicable", "Not Applicable", "Not Applicable", "Not Applicable", …
#> $ haz_inv       <chr> NA, "No", "No", "No", "No", "No", "No", "No", "No", "No", "No", "No", "No", …
#> $ haz_plac      <chr> NA, "Not Applicable", "Not Applicable", "Not Applicable", "Not Applicable", …
#> $ haz_rel       <chr> NA, "Not Applicable", "Not Applicable", "Not Applicable", "Not Applicable", …
#> $ helm_mis      <chr> "Not a Motor Vehicle Occupant", "None Used/Not Applicable", "None Used/Not A…
#> $ helm_use      <chr> "Not a Motor Vehicle Occupant", "Not Applicable", "Not Applicable", "Helmet,…
#> $ hispanic      <chr> "Non-Hispanic", "Not A Fatality (not Applicable)", "Not A Fatality (not Appl…
#> $ hit_run       <chr> NA, "No", "No", "No", "No", "No", "No", "No", "No", "No", "No", "No", "No", …
#> $ hosp_hr       <chr> "Not Applicable (Not Transported)", "Not Applicable (Not Transported)", "Unk…
#> $ hosp_mn       <chr> "Not Applicable (Not Transported)", "Not Applicable (Not Transported)", "Unk…
#> $ hospital      <chr> "Not Transported for Treatment", "Not Transported for Treatment", "EMS Unkno…
#> $ hour          <chr> "6:00pm-6:59pm", "6:00pm-6:59pm", "4:00pm-4:59pm", "4:00pm-4:59pm", "9:00pm-…
#> $ icfinalbody   <chr> NA, "Not Applicable", "Not Applicable", "Not Applicable", "Not Applicable", …
#> $ impact1       <chr> NA, "12 Clock Point", "1 Clock Point", "12 Clock Point", "3 Clock Point", "3…
#> $ inj_sev       <chr> "Fatal Injury (K)", "No Apparent Injury (O)", "Possible Injury (C)", "Fatal …
#> $ j_knife       <chr> NA, "No", "Not an Articulated Vehicle", "Not an Articulated Vehicle", "Not a…
#> $ l_compl       <chr> NA, "Valid license for this class vehicle", "No valid license for this class…
#> $ l_endors      <chr> NA, "No Endorsements required for this vehicle", "No Endorsements required f…
#> $ l_restri      <chr> NA, "Restrictions, Compliance Unknown", "No Restrictions or Not Applicable",…
#> $ l_state       <chr> NA, "Virginia", "Virginia", "Virginia", "Virginia", "Virginia", "Virginia", …
#> $ l_status      <chr> NA, "Valid", "Suspended", "Valid", "Suspended", "Suspended", "Suspended", "V…
#> $ l_type        <chr> NA, "Full Driver License", "Full Driver License", "Full Driver License", "Fu…
#> $ lag_hrs       <chr> "0", "Unknown", "Unknown", "0", "Unknown", "0", "Unknown", "Unknown", "0", "…
#> $ lag_mins      <chr> "10", "Unknown", "Unknown", "6", "Unknown", "20", "Unknown", "Unknown", "0",…
#> $ last_mo       <chr> NA, "No Record", "No Record", "No Record", "March", "March", "March", "Septe…
#> $ last_yr       <chr> NA, "No Record", "No Record", "No Record", "2021", "2021", "2021", "2018", "…
#> $ lgt_cond      <chr> "Dark - Lighted", "Dark - Lighted", "Daylight", "Daylight", "Dark - Not Ligh…
#> $ location      <chr> "Not at Intersection - On Roadway, Not in Marked Crosswalk", "Occupant of a …
#> $ m_harm        <chr> NA, "Pedestrian", "Motor Vehicle In-Transport", "Motor Vehicle In-Transport"…
#> $ mak_mod       <chr> NA, "Chevrolet Medium/Heavy Pickup (pickup-style only - over 10,000 lbs)", "…
#> $ make          <chr> NA, "Chevrolet", "Honda", "Honda", "Chevrolet", "Chevrolet", "Chevrolet", "C…
#> $ man_coll      <chr> "The First Harmful Event was Not a Collision with a Motor Vehicle in Transpo…
#> $ mcarr_i1      <chr> NA, "US DOT", "Not Applicable", "Not Applicable", "Not Applicable", "Not App…
#> $ mcarr_i2      <chr> NA, "03036659", "Not Applicable", "Not Applicable", "Not Applicable", "Not A…
#> $ mcarr_id      <chr> NA, "5703036659", "Not Applicable", "Not Applicable", "Not Applicable", "Not…
#> $ milept        <chr> "67", "67", "1337", "1337", "1016", "1016", "1016", "1016", "1170", "4036", …
#> $ minute        <dbl> 0, 0, 54, 54, 32, 32, 32, 32, 1, 21, 17, 22, 22, 22, 33, 33, 40, 40, 40, 40,…
#> $ mod_year      <chr> NA, "2015", "2008", "1997", "2005", "2005", "2005", "2016", "2017", "2020", …
#> $ model         <dbl> NA, 880, 441, 706, 2, 2, 2, 29, 40, 56, 403, 17, 481, 32, 16, 16, 404, 35, 3…
#> $ month         <chr> "January", "January", "January", "January", "January", "January", "January",…
#> $ motdir        <chr> "Not Applicable", NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
#> $ motman        <chr> "Not Applicable", NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
#> $ nhs           <chr> "This section IS NOT on the NHS", "This section IS NOT on the NHS", "This se…
#> $ nmhelmet      <chr> "Not Reported", NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, …
#> $ nmlight       <chr> "Not Reported", NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, …
#> $ nmothpre      <chr> "Not Reported", NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, …
#> $ nmothpro      <chr> "Not Reported", NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, …
#> $ nmpropad      <chr> "Not Reported", NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, …
#> $ nmrefclo      <chr> "Not Reported", NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, …
#> $ not_hour      <chr> "Unknown", "Unknown", "Unknown", "Unknown", "Unknown", "Unknown", "Unknown",…
#> $ not_min       <chr> "Unknown if Notified", "Unknown if Notified", "Unknown", "Unknown", "Unknown…
#> $ numoccs       <chr> NA, "01", "01", "01", "03", "03", "03", "01", "01", "01", "01", "01", "01", …
#> $ owner         <chr> NA, "Driver (in this crash) was  Registered Owner", "Driver (in this crash) …
#> $ p_crash1      <chr> NA, "Going Straight", "Turning Left", "Going Straight", "Going Straight", "G…
#> $ p_crash2      <chr> NA, "Pedestrian in road", "Turning Left", "From opposite direction  over lef…
#> $ p_crash3      <chr> NA, "Unknown/Not Reported", "Unknown/Not Reported", "Unknown/Not Reported", …
#> $ pbcwalk       <chr> "None Noted", NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
#> $ pbswalk       <chr> "None Noted", NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
#> $ pbszone       <chr> "None Noted", NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
#> $ pcrash4       <chr> NA, "Tracking", "Tracking", "Tracking", "Tracking", "Tracking", "Tracking", …
#> $ pcrash5       <chr> NA, "Stayed in original travel lane", "Stayed in original travel lane", "Sta…
#> $ pedcgp        <chr> "Walking/Running Along Roadway", NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,…
#> $ pedctype      <chr> "Walking/Running Along Roadway Against Traffic - From Front", NA, NA, NA, NA…
#> $ peddir        <chr> "Not Applicable", NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
#> $ pedleg        <chr> "Not Applicable", NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
#> $ pedloc        <chr> "Not At Intersection", NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, N…
#> $ pedpos        <chr> "Travel Lane", NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, N…
#> $ peds          <dbl> 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0…
#> $ pedsnr        <chr> "Not Applicable", NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
#> $ per_typ       <chr> "Pedestrian", "Driver of a Motor Vehicle In-Transport", "Driver of a Motor V…
#> $ permvit       <dbl> 1, 1, 2, 2, 4, 4, 4, 4, 1, 1, 1, 3, 3, 3, 2, 2, 6, 6, 6, 6, 6, 6, 2, 2, 2, 2…
#> $ pernotmvit    <dbl> 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0…
#> $ persons       <dbl> 1, 1, 2, 2, 4, 4, 4, 4, 1, 1, 1, 3, 3, 3, 2, 2, 6, 6, 6, 6, 6, 6, 2, 2, 2, 2…
#> $ prev_acc      <chr> NA, "None", "None", "None", "None", "None", "None", "None", "None", "None", …
#> $ prev_dwi      <chr> NA, "None", "None", "None", "None", "None", "None", "None", "None", "None", …
#> $ prev_oth      <chr> NA, "None", "None", "None", "1", "1", "1", "None", "1", "None", "None", "Non…
#> $ prev_spd      <chr> NA, "None", "None", "None", "1", "1", "1", "1", "None", "None", "1", "None",…
#> $ prev_sus1     <chr> NA, "None", "None", "None", "None", "None", "None", "None", "None", "None", …
#> $ prev_sus2     <chr> NA, "None", "None", "None", "None", "None", "None", "None", "None", "None", …
#> $ prev_sus3     <chr> NA, "None", "None", "None", "1", "1", "1", "None", "None", "None", "1", "Non…
#> $ pvh_invl      <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0…
#> $ rail          <chr> "Not Applicable", "Not Applicable", "Not Applicable", "Not Applicable", "Not…
#> $ rd_owner      <chr> "City or Municipal Highway Agency", "City or Municipal Highway Agency", "Sta…
#> $ reg_stat      <chr> NA, "Virginia", "Virginia", "Virginia", "Virginia", "Virginia", "Virginia", …
#> $ rel_road      <chr> "On Roadway", "On Roadway", "On Roadway", "On Roadway", "On Roadway", "On Ro…
#> $ reljct1       <chr> "No", "No", "No", "No", "No", "No", "No", "No", "No", "No", "No", "No", "No"…
#> $ reljct2       <chr> "Non-Junction", "Non-Junction", "Intersection", "Intersection", "Intersectio…
#> $ rest_mis      <chr> "Not a Motor Vehicle Occupant", "None Used/Not Applicable", "No Indication o…
#> $ rest_use      <chr> "Not a Motor Vehicle Occupant", "None Used/Not Applicable", "Shoulder and La…
#> $ rolinloc      <chr> NA, "No Rollover", "No Rollover", "8", "No Rollover", "No Rollover", "No Rol…
#> $ rollover      <chr> NA, "No Rollover", "No Rollover", "8", "No Rollover", "No Rollover", "No Rol…
#> $ route         <chr> "Local Street - Municipality", "Local Street - Municipality", "U.S. Highway"…
#> $ rur_urb       <chr> "Urban", "Urban", "Rural", "Rural", "Rural", "Rural", "Rural", "Rural", "Rur…
#> $ sch_bus       <chr> "No", "No", "No", "No", "No", "No", "No", "No", "No", "No", "No", "No", "No"…
#> $ seat_pos      <chr> "Not a Motor Vehicle Occupant", "Front Seat, Left Side", "Front Seat, Left S…
#> $ sex           <chr> "Male", "Male", "Male", "Male", "Female", "Female", "Male", "Female", "Male"…
#> $ sp_jur        <chr> "No Special Jurisdiction", "No Special Jurisdiction", "No Special Jurisdicti…
#> $ spec_use      <chr> NA, "No Special Use", "No Special Use", "No Special Use", "No Special Use", …
#> $ speedrel      <chr> NA, "No", "No", "No", "No", "No", "No", "No", "No", "No", "Yes, Exceeded Spe…
#> $ statename     <chr> "Virginia", "Virginia", "Virginia", "Virginia", "Virginia", "Virginia", "Vir…
#> $ str_veh       <dbl> 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0…
#> $ tow_veh       <chr> NA, "One Trailing Unit", "No Trailing Units", "No Trailing Units", "No Trail…
#> $ towed         <chr> NA, "Not Reported", "6", "6", "6", "6", "6", "6", "6", "6", "6", "6", "6", "…
#> $ trav_sp       <chr> NA, "050 MPH", "015 MPH", "055 MPH", "025 MPH", "025 MPH", "025 MPH", "060 M…
#> $ trlr1gvwr     <chr> NA, "Not Reported", "No Trailing Units", "No Trailing Units", "No Trailing U…
#> $ trlr1vin      <chr> NA, "Not Reported", "No Trailing Units", "No Trailing Units", "No Trailing U…
#> $ trlr2gvwr     <chr> NA, "No Trailing Units", "No Trailing Units", "No Trailing Units", "No Trail…
#> $ trlr2vin      <chr> NA, "No Trailing Units", "No Trailing Units", "No Trailing Units", "No Trail…
#> $ trlr3gvwr     <chr> NA, "No Trailing Units", "No Trailing Units", "No Trailing Units", "No Trail…
#> $ trlr3vin      <chr> NA, "No Trailing Units", "No Trailing Units", "No Trailing Units", "No Trail…
#> $ tway_id       <chr> "MU-8669 PRINCESS ANNE RD", "MU-8669 PRINCESS ANNE RD", "US-13", "US-13", "U…
#> $ tway_id2      <chr> NA, NA, "CHESSER RD", "CHESSER RD", "RT-655", "RT-655", "RT-655", "RT-655", …
#> $ typ_int       <chr> "Not an Intersection", "Not an Intersection", "T-Intersection", "T-Intersect…
#> $ underoverride <dbl> NA, 7, 7, 7, 0, 0, 0, 0, 7, 7, 0, 0, 0, 0, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, …
#> $ unittype      <chr> NA, "Motor Vehicle In-Transport (Inside or Outside the Trafficway)", "Motor …
#> $ v_config      <chr> NA, "Truck Pulling Trailer(s)", "Not Applicable", "Not Applicable", "Not App…
#> $ valign        <chr> NA, "Straight", "Straight", "Straight", "Not Reported", "Not Reported", "Not…
#> $ ve_forms      <dbl> 1, 1, 2, 2, 2, 2, 2, 2, 1, 1, 1, 3, 3, 3, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2…
#> $ ve_total      <dbl> 1, 1, 2, 2, 2, 2, 2, 2, 1, 1, 2, 3, 3, 3, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2…
#> $ vin           <chr> NA, "1GC5KZC88FZ1", "5FNRL387X8B0", "1HFSC2231VA9", "2G1WF52E3591", "2G1WF52…
#> $ vnum_lan      <chr> NA, "Two lanes", "Three lanes", "Two lanes", "Two lanes", "Two lanes", "Two …
#> $ vpavetyp      <chr> NA, "Blacktop, Bituminous, or Asphalt", "Blacktop, Bituminous, or Asphalt", …
#> $ vpicbodyclass <chr> NA, "Pickup", "Minivan", "Motorcycle - Street", "Sedan/Saloon", "Sedan/Saloo…
#> $ vpicmake      <chr> NA, "Chevrolet", "Honda", "Honda", "Chevrolet", "Chevrolet", "Chevrolet", "C…
#> $ vpicmodel     <chr> NA, "Silverado", "Odyssey", "GL1500SE (GOLD WING SE)", "Impala", "Impala", "…
#> $ vprofile      <chr> NA, "Level", "Level", "Level", "Not Reported", "Not Reported", "Not Reported…
#> $ vspd_lim      <chr> NA, "45 MPH", "55 MPH", "55 MPH", "60 MPH", "60 MPH", "60 MPH", "60 MPH", "6…
#> $ vsurcond      <chr> NA, "Dry", "Dry", "Dry", "Dry", "Dry", "Dry", "Dry", "Dry", "Dry", "Dry", "N…
#> $ vtcont_f      <chr> NA, "No Controls", "No Controls", "No Controls", "Device Functioning Properl…
#> $ vtrafcon      <chr> NA, "No Controls", "No Controls", "No Controls", "Yield Sign", "Yield Sign",…
#> $ vtrafway      <chr> NA, "Two-Way, Not Divided", "Two-Way, Divided, Unprotected Median", "Two-Way…
#> $ work_inj      <chr> "No", "Not Applicable (not a fatality)", "Not Applicable (not a fatality)", …
#> $ wrk_zone      <chr> "None", "None", "None", "None", "None", "None", "None", "None", "None", "Non…

The multi_ tibbles contain those variables for which there may be a varying number of values for any entity (e.g., driver impairments, vehicle events, weather conditions at time of crash). Each tibble has the requisite data elements corresponding to the entity: multi_acc includes st_case and year, multi_veh adds veh_no (vehicle number), and multi_per adds per_no (person number).

The top name-value pairs of each tibble are shown below.

myFARS$multi_acc %>% filter(!is.na(value)) %>% group_by(name, value) %>% summarize(n=n(), .groups = "drop") %>% arrange(desc(n)) %>% slice(1:10) %>% select(name, value, n) %>% knitr::kable(format = "html")
myFARS$multi_veh %>% filter(!is.na(value)) %>% group_by(name, value) %>% summarize(n=n(), .groups = "drop") %>% arrange(desc(n)) %>% slice(1:10) %>% select(name, value, n) %>% knitr::kable(format = "html")
myFARS$multi_per %>% filter(!is.na(value)) %>% group_by(name, value) %>% summarize(n=n(), .groups = "drop") %>% arrange(desc(n)) %>% slice(1:10) %>% select(name, value, n) %>% knitr::kable(format = "html")

The events tibble provides a sequence of numbered events for each vehicle in each crash. See the vignette for more information.

head(myFARS$events, 10) %>% knitr::kable(format="html")

The codebook tibble provides a searchable codebook for the data, useful if you know what concept you’re looking for but not the variable that describes it. The rfars package includes a codebook for FARS and GESCRSS (rfars::fars_codebook and rfars::gescrss_codebook). These tables span 2011-2022 whereas the codebook object returned from get_fars() and get_gescrss() only include the specified years. See the vignette for more information.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4