Skip to contents

Offset a Vector in a Looping Fashion

Usage

loop(x, n, margin = c("row", "col"), index, index1 = FALSE)

Arguments

x

A vector or a matrix

n

The number of places to offset

margin

"row" or "col" of a matrix

index

The row or column number to change

index1

Whether or not the index starts at 0 (FALSE) or 1 (TRUE)

Value

x, but with the appropriate shifting