Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

shift

shift


Description

Shift a vector by specified positive or negative lag

Usage

shift(x, lag = 1, pad = NA)

Arguments

x

A vector

lag

Number of lagged offsets, default is 1

pad

Value to fill the lagged offset with, default is NA

Value

a vector, length equal to x, with offset length filled with pad values

Author(s)

Jeffrey S. Evans <jeffrey_evans@tnc.org>

Examples

x <- 1:10

shift(x, 1)     # shift positive (from beginning of vector) by 1
shift(x, -1)    # shift negative (from end of vector) by 1
shift(x, 5, 0)  # Shift by 5 and fill (pad) with 0

spatialEco

Spatial Analysis and Modelling Utilities

v1.3-6
GPL-3
Authors
Jeffrey S. Evans [aut, cre], Melanie A. Murphy [ctb], Karthik Ram [ctb]
Initial release
2021-03-24

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.