Skip to contents

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
)

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.

Value

A logical.

Details

The function is vectorized.

Examples

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