R/internal_helpers.R

Defines functions is_whole_positive is_whole_number

# Internal functions

## Check whether something is a whole number

is_whole_number <- function(x){
  if(is.integer(x)){
    TRUE
  } else if(is.numeric(x)){
    if((x%%1) == 0 ){
      TRUE
    } else {
      FALSE
    }
  } else {
    FALSE
  }
}

is_whole_positive <- function(x){
  if(is_whole_number(x) && x >= 0) TRUE else FALSE
}
CenterForStatistics-UGent/xnet documentation built on June 4, 2021, 4:52 p.m.