Learn R Programming

fHMM (version 1.1.1)

is_number: Check for integers

Description

This function checks if x is a ((non)-negative) ((non-)positive) (integer) numeric (vector).

Usage

is_number(
  x,
  int = FALSE,
  neg = FALSE,
  non_neg = FALSE,
  pos = FALSE,
  non_pos = FALSE
)

Value

A logical.

Arguments

x

Any R object.

int

A logical, if TRUE checks if x is an integer.

neg

A logical, if TRUE checks if x is negative.

non_neg

A logical, if TRUE checks if x is non-negative.

pos

A logical, if TRUE checks if x is positive.

non_pos

A logical, if TRUE checks if x is non-positive.

Details

The function is vectorized.

Examples

Run this code
if (FALSE) {
is_number(1, int = TRUE)
is_number(pi, int = TRUE)
}

Run the code above in your browser using DataLab