Description Usage Arguments Details Value Author(s) See Also Examples
Shifts values up or down by a given number of positions within blocks and on selected elements.
1 |
x |
A vector in |
id |
A valid |
shift.by |
An integer specifying the number of positions to shift by. Can be positive (shift down) or negative (shift up). |
ind |
A logical vector that designates a subset of |
fill |
A value to use when no other value is appropriate. |
This function operates on data sets in block-format
.
The number of positions by which to shift by may be positive or
negative, with positive indicating downwards in the data set and
negative upwards. Additionally, a subset on which to perform the
operation can be selected with ind
. For elements that are
not selected the corresponding result is given by fill
.
Shifting creates ‘gaps’ at the start (or end if shift.by
is
negative) of a block. The gaps are filled with the value
fill
so that the result is in block-format
with
respect to id
.
A vector in block-format
with respect to id
containing the shifted values.
Ben Rich <benjamin.rich@certara.com>
block-format
lag
1 2 3 4 5 6 7 8 |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.