knitr::opts_chunk$set(collapse = TRUE, comment = NA, fig.path = "man/figures/README-")
rfars is an R package with a set of functions that makes easier to analyze the data from the US National Highway Traffic Safety Administration's Fatality Analysis Reporting System (FARS).
# Install the package from GitHub without the vignette: devtools::install_github("Cesar-Urteaga/rfars") # Or you can include it: devtools::install_github("Cesar-Urteaga/rfars", build_vignettes = TRUE)
The aim of this project was to combine the skills of creating, writing, and testing an R package, using the R files provided in the course Building R Packages offered by the Johns Hopkins University through the Coursera's platform.
For this assessment, it was required to perform the following tasks:
In order to create this package, I followed this path:
Github Document (Markdown
)).Project Options
within the Tools
menu and Git/SVN
tab; select Git as version control system
. Thereupon, add the remote through the Git browser using the shell. Later, edit the .gitignore
and .Rbuildignore
files.git push -u origin master
(subsequent commits can be pushed in RStudio's Git browser).devtools
creates this file with the function document()
).devtools::document()
(or press Ctrl/Cmd + Shift + D in RStudio) in order to create the .Rd
files. Later, press the RStudio's Build & Reload
button (Ctrl/Cmd + Shift + B) and review the help files with ?
.@importFrom
sections of the roxygen2-style documentation to fill the Imports
section.devtools::use_vignette("vignette-name")
; then, modify the vignette and press Ctrl/Cmd + Shift + K to knit it.R CMD Rd2pdf package-name
in the parent folder of the package..bz2
files), you should store them in the inst\extdata folder (please refer to the section of raw data of the book "R packages" by Hadley Wickham); moreover, use the function system.file
to know where the external files are stored once the package is installed (see the examples in the documentation).devtools::use_testthat()
and include the tests in the testthat folder. Once you have added the tests, execute devtools::test()
(Ctrl/Cmd + Shift + T) to carry out each one. Please review the chapter of testing in the Hadley's book. Check
button in the Build
tab of RStudio
. N.B.: It is possible that you could get the following note: "no visible binding for global variable variable-name". To get around of it, see the suggested solution in stackoverflow.devtools::use_travis()
command and activating the package's repository in your Travis account; thereupon, add, commit, and push your changes in Github and insert the Travis badge into the README file. N.B.: For the AppVeyor service use devtools::use_appveyor()
and check the AppVeyor's documentation to add the badge into the README file.License: GPL-3 | file LICENSE
).covr::codecov(token = "YOUR_TOKEN_GOES_HERE")
with the ascribed token. N.B.: Do not forget to include the codecov
badge into the README file. The session in which I have created this package was the following:
sessionInfo()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.