shift: Function that shifts vector values to right or left

View source: R/utils.R

shiftR Documentation

Function that shifts vector values to right or left

Description

Taken from https://stackoverflow.com/questions/26997586/shifting-a-vector by user petermeissner.

Usage

shift(x, n, invert = FALSE, default = NA)

Arguments

x

Vector for which to shift values

n

Number of places to be shifted. Positive numbers will shift to the right by default. Negative numbers will shift to the left by default. The direction can be inverted by the invert parameter.

invert

Whether or not the default shift directions should be inverted.

default

The value that should be inserted by default.


andrew-edwards/EDMsimulate documentation built on Oct. 25, 2023, 2:43 p.m.