inspect_log_base: Validate logarithmic bases

Description Usage Arguments Details Value See Also Examples

View source: R/inspect_.R

Description

inspect_log_base checks if an object is a valid a logarithmic base. This can be useful to validate inputs in user-defined functions.

Usage

1

Arguments

x

An arbitrary object.

Details

inspect_log_base conducts a series of tests to check if x is a valid logarithmic base. Namely, inspect_log_base checks if:

Value

inspect_log_base does not return any output. There are two possible outcomes:

See Also

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# Calls that pass silently:
x1 <- 10
x2 <- exp(1)
x3 <- 0.5
inspect_log_base(x1)
inspect_log_base(x2)
inspect_log_base(x3)

# Calls that throw informative error messages:
mylist <- list(
  NULL, numeric(0), TRUE, factor(10),
  list(10), matrix(10), NaN, NA, -1, 0
)
try(inspect_log_base(mylist[[1]]))
try(inspect_log_base(mylist[[2]]))
try(inspect_log_base(mylist[[3]]))
try(inspect_log_base(mylist[[4]]))
try(inspect_log_base(mylist[[5]]))
try(inspect_log_base(mylist[[6]]))
try(inspect_log_base(mylist[[7]]))
try(inspect_log_base(mylist[[8]]))
try(inspect_log_base(mylist[[9]]))
try(inspect_log_base(mylist[[10]]))

inspector documentation built on June 18, 2021, 1:06 a.m.