R/trunc.R

#' trunc
#'
#' @param data The input variable which will be altered if less than the threshold
#' @param min_value the threshold which the input below it will be set to zero
#'
#' @return returns zero if the "data" is less than the "mean_value" otherwise returns the "data"
#'
#'
#' @examples
#' \donttest{
#' trunc(4,3)  # returns 4
#' trunc(2,3)  # returns 0
#' }
trunc = function(data, min_value){
  return(ifelse(data < min_value, 0, data))
}
Javad-mun/rubin documentation built on June 5, 2019, 11:01 a.m.