R/numcheck.R

Defines functions numcheck

Documented in numcheck

numcheck <- 
  function(argum) 
{
    argnam <- deparse(substitute(argum))
    if (length(argum) != 1L) {
      stop(sprintf("Input '%s' must contain only a single value.", argnam), 
           call. = FALSE)
    }
    if (!(is.numeric(argum))) {
      stop(sprintf("Input '%s' must be of class 'numeric'.", argnam), 
           call. = FALSE)
    }
    if ((is.infinite(argum)) || (is.na(argum)) || (is.nan(argum))) { 
      stop(sprintf("Input '%s' must be a finite number and cannot be NA \n 
                   or NaN.", argnam), call. = FALSE)
    }
}

Try the cpfa package in your browser

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

cpfa documentation built on Aug. 8, 2025, 6:24 p.m.