tf_minmax: Depth-based minimum, maximum and range for 'tf' vectors

tf_minmaxR Documentation

Depth-based minimum, maximum and range for tf vectors

Description

By default, min, max, and range compute pointwise extremes (the existing behaviour). When a depth argument is supplied, they instead return the most extreme / most central observation according to the chosen depth. For the default "MHI" depth this gives the lowest / highest function in an up-down sense.

Usage

## S3 method for class 'tf'
min(..., na.rm = FALSE, depth = NULL)

## S3 method for class 'tf'
max(..., na.rm = FALSE, depth = NULL)

## S3 method for class 'tf'
range(..., na.rm = FALSE, depth = NULL)

Arguments

...

tf objects (and na.rm for the pointwise default).

na.rm

logical; passed on to the pointwise summary or used to filter NAs before computing depth.

depth

depth method to use. NULL (default) gives the pointwise min/max/range. Supply a depth name (e.g. "MHI") or a custom depth function for depth-based selection.

Value

a tf object.

See Also

tf_depth(), rank.tf()

Other tidyfun ordering and ranking functions: tf_depth(), tf_order

Examples

x <- tf_rgp(5) + 1:5
# pointwise (default):
min(x)
max(x)
# depth-based:
min(x, depth = "MHI")
max(x, depth = "MHI")

tf documentation built on April 7, 2026, 5:07 p.m.