title: "Package FARSread" author: "DocOfi" date: "March 26, 2017" output: html_document: fig_height: 4 highlight: pygments theme: spacelab keep_md: yes toc: yes
The goal of this package is to create a summary and visualization of the Fatality Analysis Reporting System (FARS) data from the National Highway Traffic Safety Administration NHTSA. FARS contains data derived from a census of fatal motor vehicle traffic crashes within the 50 States, the District of Columbia, and Puerto Rico.
Interested parties may access data tables at NHTSA, download files via FTP at ftp://ftp.nhtsa.dot.gov/fars/, or make requests through the Publications and Data Requests page. Information requests can also be made by phone at 800-934-8517, or by e-mail at ncsaweb@dot.gov.
The family of functions available in this package will allow the user to read and analyze the data in R. The summary tables provided by the function fars _summarize_years
shows the number of observed accidents per month in a particular year. The resulting table can then be plotted.
The package provides a function fars_map_state
,that allows the user to visualize the location of accidents in a particular State in a particular year. The output of the function is a map plot based on the longitude and latitude data in FARS.
The function fars_read
requires the data to be in a .csv format while ther rest of the other functions in this package require that the data be in .csv.bz2 format. In order to change a .csv file to .csv.bz2 format, you'll have to read the file first into R using the fars_read
function and assign the result to an R obect like R_variable
. You may then use the write.csv function in R to create the a file file_name.csv.bz2
as shown in the code below. Be sure to add the argument row.names = FALSE
to avoid creating a new column/variable of row numbers. You may then use the function fars _summarize_years
to create the summary table described above as well as the function fars_map_state
to create the map plot.
R_variable <- fars_read("accident_2013.csv")
write.csv(R_variable, file = bzfile("file_name.csv.bz2"), row.names = FALSE)
To view the html files in the vignettes folder, click on the following links:
An interactive dashboard can be accessed through this link Interactive dashboard
“Because Traffic has a memory. It’s Amazing!!! It’s like a living organism”
- Ethan Hunt, Mission Impossible
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.