R/number.R

Defines functions number

Documented in number

#' Number Check
#'
#' Checks if an object is a number. If required, it checks if the object is an integer.
#'
#' @param x An \code{R} object.
#' @param int Logical. Should \code{x} be an integer?
#'
#' @return A logical value.
#'
#' @note This is an internal function.
#'
#' @author Michele Cianfriglia \email{michele.cianfriglia@@uniroma1.it}
#'
#' @keywords internal

number <- function(x, int = FALSE) {

  if (int) {
    is.numeric(x) && length(x) == 1 && !is.nan(x) && x == floor(x)
  } else {
    is.numeric(x) && length(x) == 1 && !is.nan(x)
  }

}
michelecianfriglia/SampleSizeWass documentation built on Feb. 28, 2023, 8:56 a.m.