shifter: Shift elements in vector by specific distance and direction

Description Usage Arguments Examples

View source: R/RecodeR.R

Description

This function is to shift elements in vector by specific distance and direction

Usage

1
shifter(vector = x, distance = n, direction = c("left", "right"))

Arguments

vector

numeric or character vector

distance

integer

direction

c("left", "right")

Examples

1
2
3
shifter(1:4, 0, "left")#1 2 3 4
shifter(1:4, 1, "left")#2 3 4 1
shifter(1:4, 1, "left")#Distance to be shifted exceeds length of vector

momo3246/recode documentation built on Sept. 30, 2020, 2:14 p.m.