#' @title Check input
#'
#' @description Checks if x is a proper input
#'
#' @param x Vector of dimension S (number of species) with the number of individuals observed in each species, or the distribution frequencies of species. NA values are allowed.
#'
#' @return x without NA or 0 values
#'
#' @keywords internal
check_x  <- function(x){
  x <- stats::na.omit(x)
  stopifnot(is.numeric(x))
  x <- ifelse(x==0, NA, x)
  x <- stats::na.omit(x)
  stopifnot(all(x >0))
  if (sum(x) !=1)  stopifnot(isTRUE(all.equal(x, round(x))))
  return(x)
}
