isMonotonic: Indicates if a sequence of values are monotonic

Description Usage Arguments Value Examples

View source: R/isMonotonic.R

Description

Indicates if a sequence of values are (non strictly) montonic increasing, decreasing or either.

Usage

1
isMonotonic(v_n_values, s_direction = "either")

Arguments

v_n_values

numeric vector. Length of v_n_values must be at least 1.

s_direction

a string of the monotonic direction we are interested. Must be 'decreasing' 'increasing' or 'either'.

Value

a boolean (logic vector length one) indicating if the sequence of values is monotonic. If v_n_values has a NA value the result is NA.

Examples

1
2
3
4
5
isMonotonic(c(1,1,2,3))
isMonotonic(c(1,1,NA, 2,3))
isMonotonic(1:5, s_direction = "increasing")
isMonotonic(1:5, s_direction = "decreasing")
isMonotonic(5:1, s_direction = "decreasing")

AlejandroKantor/akmisc documentation built on May 5, 2019, 3:51 a.m.