knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.path = "man/figures/README-", out.width = "100%" )
The purpose of this assessment is for you to combine your skills of creating, writing, documenting, and testing an R package with releasing that package on GitHub. In this assessment you'll be taking the R files from Week 2's assessment about documentation and putting that file in an R package.
For this assessment you must
Unfortunatelly, I have made some modification to clear any erros
, warnings
and notes
in all functions.
The most annoying problem is the no visible binding for global variable.
I have found in the Github an issues due to this problem:
Which led me to another issue in Stack Overflow.
Finally, I found the solution in dplyr website.
If this function is in a package, using .data also prevents R CMD check from giving a NOTE about undefined global variables (provided that you’ve also imported rlang::.data with @importFrom rlang .data).
I realize that in the first link of Github someone said the above quotation.
Whenever I saw a magrittr operator I must use the .data
to point the oculted dataset. An example is the fars_read_years
function, where I put .data$MONTH
and .data$year
.
fars_read_years <- function(years) { lapply(years, function(year) { file <- make_filename(year) tryCatch({ dat <- fars_read(file) dplyr::mutate(dat, year = year) %>% dplyr::select(.data$MONTH, .data$year) }, error = function(e) { warning("invalid year: ", year) return(NULL) }) }) }
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.