mark_last_peak: Mark the location of the last maximum value in a vector

View source: R/number_tools.R

mark_last_peakR Documentation

Mark the location of the last maximum value in a vector

Description

Mark the location of the last maximum value in a vector

Usage

mark_last_peak(vec, threshold = NULL)

Arguments

vec

(Numeric) A vector.

threshold

(Numeric or NULL) The smallest acceptable peak value. NULL means no threshold.

Value

A bool vector of the same length as vec, with the last maximum marked with a TRUE.

Authors

Examples

input <- c(1, 2, 3, 3, 1)
mark_last_peak(input, threshold = NULL)

#> [1] FALSE FALSE FALSE  TRUE FALSE

mark_last_peak(input, threshold = 4)

#> [1] FALSE FALSE FALSE FALSE FALSE


DesiQuintans/desiderata documentation built on April 9, 2023, 5:43 a.m.