Description Usage Arguments Details Value Examples
Similar to isTRUE(all(x >= lo & x <= hi))
with default settings,
except that it is substantially faster and returns a string describing the
first encountered violation rather than FALSE on failure.
1 
x 
vector logical (treated as integer), integer, numeric, or character. Factors are treated as their underlying integer vectors. 
lo 
scalar vector of type coercible to the type of 
hi 
scalar vector of type coercible to the type of 
na.rm 
TRUE, or FALSE (default), whether NAs are considered to be
in bounds. Unlike with 
bounds 

You can modify the comparison to be strictly greater/less than via the
bounds
parameter, and the treatment of NAs with na.rm
. Note that NAs are
considered to be out of bounds by default. While technically incorrect
since we cannot know whether an NA value is in or out of bounds, this
assumption is both conservative and convenient. Zero length x
will always
succeed.
If x
and lo
/hi
are different types, lo
/hi
will be coerced to the
type of x
. When lo
/hi
are numeric and x
is integer, if lo
/hi
values are outside of the integer range then that side will be treated as if
you had used Inf
/Inf
. Inf
and Inf
mean lo
and hi
will be
unbounded for all data types.
TRUE if all values in x
conform to the specified bounds, a string
describing the first position that fails otherwise
1 2 3 4 5 6 7 8 9 10  all_bw(runif(100), 0, 1)
all_bw(runif(100) * 2, 0, 1)
all_bw(NA, 0, 1) # This is does not return NA
all_bw(NA, 0, 1, na.rm=TRUE)
vec < c(runif(100, 0, 1e12), Inf, 0)
all_bw(vec, 0) # All +ve numbers
all_bw(vec, hi=0) # All ve numbers
all_bw(vec, 0, bounds="(]") # All strictly +ve nums
all_bw(vec, 0, bounds="[)") # All finite +ve nums

Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.