findAbsMin: Return the value (or the element with the value) closest to...

Description Usage Arguments Value Author(s) See Also Examples

View source: R/util.R

Description

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

Usage

1
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

Other Utility functions: find_n_neighbors(), firstLetterCap(), getArrowPos(), getDec(), getRange(), getRatioCoords(), get_palette(), group_sort(), inch2coords(), isColor(), list2str(), move_n_point(), orderBoxplot(), se(), sortGroups()

Examples

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

plotfunctions documentation built on April 28, 2020, 5:10 p.m.