Learn R Programming

dynutils (version 1.0.11)

is_single_numeric: Check whether a value is a single numeric

Description

Check whether a value is a single numeric

Usage

is_single_numeric(x)

Arguments

x

A value to be tested

Examples

Run this code
if (FALSE) {
library(assertthat)
assert_that(is_single_numeric(1))
# TRUE

assert_that(is_single_numeric(Inf))
# TRUE

assert_that(is_single_numeric(1.6))
# TRUE

assert_that(is_single_numeric(NA))
# Error: NA is not a single numeric value

assert_that(is_single_numeric(1:6))
# Error: 1:6 is not a single numeric value

assert_that(is_single_numeric("pie"))
# Error: "pie" is not a single numeric value
}

Run the code above in your browser using DataLab