fars_read_years: Create a dataframe only for the specific years. Each year...

Description Usage Arguments Value Note Examples

View source: R/io.R

Description

Create a dataframe only for the specific years. Each year would have a filename of the form accident_<year>.csv.bz2

Usage

1

Arguments

years

A vector of integers

Value

list of dplyr tbl_df instances each for the year. If data for the year specified cannot be found, a warning is printed and NULL is returned for that entry in the year.

Note

This call assumes that the data files are directly accessible under the current directory. Use getwd() to confirm.

MONTH refers to the numeric representation with January being 1.

Examples

 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
## Not run: 
data <- fars_read_years(c(2014, 2015, 2021))
Warning message:
In value[[3L]](cond) : invalid year: 2021

> head(x=data[1])
[[1]]
A tibble: 30,056 x 2
MONTH  year
# <int> <dbl>
 1     1  2014
2     1  2014
3     1  2014
4     1  2014
5     1  2014
6     1  2014
7     1  2014
8     1  2014
9     1  2014
10     1  2014
# ... with 30,046 more rows
> head(x=data[2])
[[1]]
# A tibble: 32,166 x 2
MONTH  year
<int> <dbl>
  1     1  2015
2     1  2015
3     1  2015
4     1  2015
5     1  2015
6     1  2015
7     1  2015
8     1  2015
9     1  2015
10     1  2015
# ... with 32,156 more rows
> head(data[3])
[[1]]
NULL

## End(Not run)

balajiambreshrajkumar/fars documentation built on May 28, 2019, 6:36 p.m.