fars_read_years: Subsetting 'Year' & 'Month' variables from the data.

Description Usage Arguments Value Note Examples

View source: R/fars_functions.R

Description

Subsets Year & Month variables from the data, if the file is present in the working directory (in case year = 2013, 2014, 2015), otherwise prints 'Invalid year'.

Usage

1

Arguments

years

The year for which the Year & Month variables are to be subsetted from the data. This should be integer.

Value

The data present in the file (in case year = 2013, 2014, 2015). This is an object of class 'tbl_df'. In case the file is not present corresponding to the year supplied in the argument, it returns a list of length 1 with object as NULL.

Note

Requires 'readr' and 'dplyr' packages to be loaded first.

Examples

1
2
3
4
## Considering your data is in the present working directory
## The following would work fine and would return the subsetted data.
mydata <- fars_read_years(2014)
str(mydata)

abhinav-piplani/Assignment1 documentation built on May 27, 2019, 7:39 a.m.