safe_min | R Documentation |
Modified version of base::min()
that differs in the following ways:
NA
s in the input (...
) are ignored by default (rm_na = TRUE
).
If the input is of length zero, the output will also be of length zero (of the same type as the input).
It is ensured that all inputs are either numeric, of length zero or NA
. The only case where the return value will be -Inf
or NA
is when the input
contains only -Inf
or NA
.
Dynamic dots are supported.
safe_min(..., rm_na = TRUE)
... |
Numeric objects of which to determine the minimum. Dynamic dots are supported. |
rm_na |
Ignore missing values in |
A numeric scalar or empty value, of the same type as ...
.
Other statistical computing / numeric functions:
round_to()
,
safe_max()
,
safe_seq_len()
,
stat_mode()
# other than `base::min()`, this function removes `NA`s by default
min(1, NA_real_, 2)
pal::safe_min(1, NA_real_, 2)
# other than `base::min()`, this function does not return `-Inf` or `NA_character_` for
# zero-length inputs
min(NULL)
min(integer())
pal::safe_min(NULL)
pal::safe_min(integer())
# other than `base::min()`, this function fails for non-numeric inputs
min("zero", 1L)
min("zero", "one")
min(character())
try(pal::safe_min("zero", 1L))
try(pal::safe_min("zero", "one"))
try(pal::safe_min(character()))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.