Learn R Programming

simsem (version 0.2-8)

whichMonotonic: Extract a part of a vector that is monotonically increasing or decreasing

Description

Extract a part of a vector that is monotonically increasing or decreasing. This function will go to the anchor value and extract the neighbor values that are monotonically increasing or decreasing.

Usage

whichMonotonic(vec, ord=NULL, anchor=NULL)

Arguments

vec
The target vector to be extracted
ord
The names of each element of the vector to be attached
anchor
The position of the element to be anchored. The default value is the middle position.

Value

  • The monotonic part of a vector

Examples

Run this code
# This is a private function.

# whichMonotonic(c(3, 4, 1, 2, 3, 5, 2, 1))

Run the code above in your browser using DataLab