Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

findAbsMin

Return the value (or the element with the value) closest to zero.


Description

Return the value (or the element with the value) closest to zero.

Usage

findAbsMin(x, element = FALSE)

Arguments

x

A numeric vector.

element

Logical: whether or not to return the value (FALSE, default) or the index (TRUE).

Value

The value or index of the element closest to zero (absolute minimum).

Author(s)

Jacolien van Rij

See Also

Examples

(test <- seq(-25,25, by=3))
min(test[test>0])
max(test[test<0])
min(abs(test))
findAbsMin(test)

plotfunctions

Various Functions to Facilitate Visualization of Data and Analysis

v1.4
GPL (>= 2)
Authors
Jacolien van Rij [aut, cre]
Initial release
2020-04-30

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.