This repository is connected with the final assignment for Building R Packages module of the Mastering Software Development in R specialization (coursera). The goal is to apply the basic concepts learnt in the module for creating, writing, documenting, and testing an R package.
The development of the package is done introducing the following software engineering practices:
- version control using Github/ Git
- Test Driven Development with unit tests and integration tests
- Continuous Integration (CI) using Travis CI
- add the FARS R code provided during the course
- refactor R code in order to remove the Non-Standard Evaluation Issue dplyr NSE vignette, NSE explained.
- document the code, creating related help functions with
roxygen2
- document the package, using a README file and a vignette to include in your package with
knitr
and R Markdown - add some unit tests / integration tests using
testthat
- add the package on GitHub
- set up the repository so that the package can be checked and built on Travis with no errors, warnings or notes. See Travis Build History
IMPORTANT!! The "maps" package has been added in the Depends section in the DESCRIPTION file because it sets some environment variables when its loaded & attached, which doesn't happen if maps::map() is used throwing a "stateMapEnv not found" error.
The goal of fars
is to help you performing basic operation on Fatality Analysis Reporting System (FARS) data, a nationwide census providing the American public yearly data regarding fatal injuries suffered in motor vehicle traffic crashes. Specifically it allows you to perform the following operations:
- load the FARS datafile by filename or by years,
- summarize the number of fatal injuries suffered in motor vehicle traffic crashes by month and year,
- visualize the fatal injuries suffered in motor vehicle traffic crashes in a specific state (USA) for a specific year.
#Using devtools and Github
devtools::install_github("pparacch/fars")
#load and attach the package
library(farsr)
Use the following table to have an overview of the provided functions:
Function | |
---|---|
fars_read() |
Read a FARS datafile |
fars_read_years() |
Read FARS datafile(s) for provided year(s) |
fars_summarize_years() |
Summarizes injuries by month for provided year(s) |
fars_map_state() |
Visualize map with injuries for provided state (USA) and year |
More info can be found in the package vignette vignette('introduction', package = 'farsr')
and help of provided function e.g. ?farsr::fars_read_years
.