Learn R Programming

itsadug (version 0.8)

findAbsMin: Utility function.

Description

Utility function.

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).

See Also

Other Data utility functions: find_n_neighbors; group_sort; move_n_point; print_summary; summary_data

Examples

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

Run the code above in your browser using DataLab