Take the maximum of the absolute values of an input vector.

absmax(x, na.rm = FALSE)

Arguments

x

A numeric vector or array.

na.rm

A logical indicating whether missing values should be removed.

Value

The maximum of the absolute values of elements of the input vector.

Examples

x <- c(5, 3, -9, -100, 3.14159, 7.5) absmax(x)
#> [1] 100
#