shift: Shifts a vector's elements left or right by N elements.

Description Usage Arguments Value Examples

Description

Shifts a vector's elements left or right by N elements.

Usage

1
2
3
4
5
6
7
8
  shift(x, ...)

  ## Default S3 method:
 shift(x, n = 1, wrap = TRUE,
    pad = FALSE, ...)

  ## S3 method for class 'data.frame'
 shift(x, ...)

Arguments

x

A vector to be operated on

n

Number of rows to shift by (if negative, shift to right instead of left)

wrap

Whether to wrap elements or not (adds the entry at the beginning to the end)

pad

Whether to pad with NAs or not. pad does nothing unless wrap is false, in which case it specifies whether to pad with NAs

...

Other items to pass along

Value

vector of the same type as vec

Examples

1
2
test <- seq(10)
shift(test)

gsk3/taRifx documentation built on May 17, 2019, 8:55 a.m.