#' @export
#'
#' @title suppressBindingNotes
#'
#' @description Ensure resolution of NOTEs from the calling of package
#' \code{devtools} function \code{check()}.
#'
#' @param variablesMentionedInNotes A variable returned from
#' \code{devtools::check()} for which a NOTE is returned.
#'
#' @details A helper function to assist in meeting R package devtools::check()
#' requirements. Found via Stack Overflow post "In R, is it possible to
#' suppress 'Note: no visible binding for global variable?'" This function is
#' utilized in function \code{assignLSCompare} to wrap certain variables
#' utilized via function \code{dplyr}.
#'
#' @author Tyler Rinker
#'
#' @examples
#' # ---- See the Stack Overflow post described in Details.
#'
#' @keywords internal
# Use of the @keywords internal syntax ensures this function's documentation
# could be called via a help(suppressBindingNotes) from within an R Console, but
# prevents it from being listed in the campR package pdf documentation.
# http://stackoverflow.com/questions/23475309/in-r-is-it-possible-to-suppress-note-no-visible-binding-for-global-variable
# Accessed August 25, 2016 by Jason.
# Intent:
# This function suppresses the following notes generated by "R CMD check":
# - "Note: no visible binding for global variable '.->ConfigString'"
# - "Note: no visible binding for '<<-' assignment to 'ConfigString'"
# Usage:
# Add the following right in the beginning of the .r file (before the Reference
# class is defined in the sourced .r file):
# suppressBindingNotes(c(".->ConfigString","ConfigString"))
suppressBindingNotes <- function(variablesMentionedInNotes) {
for(variable in variablesMentionedInNotes) {
# Utilize this construction to avoid NOTEs about assigning variables to the
# .GlobalEnv when running devtools::check().
pos <- 1
envir <- as.environment(pos)
assign(variable,NULL, envir = envir)
}
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.