Description Usage Arguments Details Value See Also Examples
inspect_log_base
checks if an object is a valid a logarithmic
base. This can be useful to validate inputs in user-defined functions.
1 |
x |
An arbitrary object. |
inspect_log_base
conducts a series of tests to check if x
is a
valid logarithmic base. Namely, inspect_log_base
checks if:
x
is NULL
or empty.
x
is an atomic vector of length
1.
x
is numeric.
x
is NA
or NaN
.
x
is positive.
inspect_log_base
does not return any output. There are two possible
outcomes:
The call is silent if x
is a numeric vector of length
1 that is a valid logarithmic base.
An informative error message is thrown otherwise.
bfactor_log_interpret
for the interpretation of the
logarithms of Bayes factors.
inspect_bfactor_log
to check if an object is a
numeric vector of valid logarithmic Bayes factor values.
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]]))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.