findMovement: Find subsequences based on movement In jsks/seqR: Ordinal Sequence Analysis

Description

Given a sequence of numbers, as a numeric vector, find the increasing or decreasing subsequences.

Usage

 ```1 2``` ```findMovement(v, direction = "up", buffer = 0L, lbuffer = NULL, rbuffer = NULL, upper_lim = NULL, lower_lim = NULL) ```

Arguments

 `v` A numeric vector. `direction` Character string of either "up" to find increasing sequences or "down" to find decreasing sequences. Default: "up". `buffer` Optional parameter indicating how many repeated elements to include to the left (prior to the start) and right (following the end) of a subsequence. `lbuffer` Optional parameter indicating how many repeated elements to include to the left (prior to the start) of a subsequence. Takes precedence over the option `buffer`. `rbuffer` Optional parameter indicating how many repeated elements to include to the right (following the end) of a subsequence. Takes precedence over the option `buffer`. `upper_lim` Optional parameter that filters out subsequences which do not reach an upper lim. `lower_lim` Optional parameter that filters out subsequences which do not begin below a given lim.

Details

`findMovement` finds the subsequences within a numeric vector based on either increasing or decreasing movement. An increasing subsequence is defined as a sequence of values where `V[n] >= V[n - 1]`. The start point is strict, meaning the first point where `V[n] < V[n + 1]`. The option `lbuffer` can be specified to include an arbitrary number, `k`, of constant elements prior to `V[n]` where `V[n - k] == V[n]`. Likewise, the end point of a subsequence is the element where `V[n] > V[n + 1]` or `V[n + 1]` is NA. `rbuffer` will also include a constant number of elements after the end point. Alternatively, the option `buffer` can be used to specify equal buffering at both the start and end of subsequences.

Value

A numeric vector of the same length as `v` where subsequences are given values 1:N and elements falling outside of subsequences are set to `NA`.

Examples

 ```1 2 3 4 5 6``` ```x <- c(4, 4, 3, 1, 0, 1, 0, 1, 2, 2, 2, 3, 3) findMovement(x) findMovement(x, direction = "down") # Let's find buffered subsequences that increase starting at 2 findMovement(x, buffer = 1, lower_lim = 2) ```

jsks/seqR documentation built on May 9, 2019, 12:48 p.m.