-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathREADME.Rmd
45 lines (31 loc) · 1.7 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, echo = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "README-"
)
```
# Introduction to fars
The `fars` package analyses data from the US National Highway Traffic Safety Administration's [Fatality Analysis Reporting System](https://www.nhtsa.gov/research-data/fatality-analysis-reporting-system-fars), which is a nationwide census providing the American public yearly data regarding fatal injuries suffered in motor vehicle traffic crashes.
## Summarize accidents
If you are interested in the number of accidents per month and year, you can count them with the `fars_summarize_years` function. You only need to provide the `years` of interest. The function will create the `filename`s using the `make_filename` function, read in the files from your current working directory using the `fars_read` function, and finally summarize the data.
```{r setup, include=FALSE}
require("knitr")
require("fars")
opts_knit$set(root.dir = system.file("extdata", package = "fars"))
```
```{r summarize, echo=TRUE}
fars_summarize_years(2013:2015)
```
## Map accidents
In order to display the point locations of accidents for a given state `state.num` and `year`, you can use the `fars_map_state` function.
```{r map, echo=TRUE}
fars_map_state(39, 2013)
```
AppVeyor [![Build status](https://ci.appveyor.com/api/projects/status/daovsxh32wuptc7t/branch/master?svg=true)](https://ci.appveyor.com/project/la-sch/fars/branch/master)
Travis [![Travis-CI Build Status](https://travis-ci.org/la-sch/fars.svg?branch=master)](https://travis-ci.org/la-sch/fars)
[Travis log](https://travis-ci.org/la-sch/fars)