Description Usage Arguments Details Value Examples
Given a sequence of numbers, as a numeric vector, find the increasing or decreasing subsequences.
1 2 | findMovement(v, direction = "up", buffer = 0L, lbuffer = NULL,
rbuffer = NULL, upper_lim = NULL, lower_lim = NULL)
|
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
|
rbuffer |
Optional parameter indicating how many repeated
elements to include to the right (following the end) of a
subsequence. Takes precedence over the option
|
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. |
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.
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
.
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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.