R/vprint.R

Defines functions vprint

Documented in vprint

#' vprint
#' 
#' @description more flexible form of if(verbose) print(...)
#' 
#' @param class integer representing the verbose class
#' @param verbose integer vector representing classes
#' @param txt argument to print
#'
#' @examples
#' vprint(1,1:2,"try me")
#' vprint(0,1:2,"try me")
#' vprint(3,1:2,"try me")
#' 
#' @details
#' if you are the developer, and you have some debug statements
#' rather than comment them out, you can turn them off and on
#' likewise, a user can request more or less informational comments
#' 
#' suggested standardized class codes for vprint():
#' 
#' -1 = developer debugging only
#' 
#' 0 = constitutively turned on
#' 
#' 1 = help for new user
#' 
#' 2 = follow progress of long computation
#' 
#' 3 = primary results
#' 
#' 4 = meta info (e.g. dims of a mat before/after trimming)
#' 
#' 5 = warnings
#' 
#' 6 = errors
#' 
#' Note that the class argument is hardwired into the function code by
#' the developer. For example, for a debugging statement, '-1' is
#' hardwired in. The choice of whether or not to display this message is
#' subsequently governed by the user selecting which values
#' to include in the 'verbose' vector parameter.
#' 
#' @return returns no values but has side effect of printing some text
#' 
#' @export
vprint<-
  function(class,verbose=NULL,txt) {
    if(class %in% verbose | class==0)
      print(txt,quote=FALSE)
  }

Try the vprint package in your browser

Any scripts or data that you put into this service are public.

vprint documentation built on June 8, 2025, 11:12 a.m.