Learn R Programming

binhf (version 1.0-3)

shift: Shift function

Description

This function shifts a vector input a certain number of places in the direction desired.

Usage

shift(v, places, dir = "right")

Arguments

v

a vector of input values.

places

the number of places to shift v.

dir

The direction to shift v.

Value

vnew

the shifted version of v.

Details

The function shifts the vector v by places in the direction of direction, using wrapping at the boundaries. Used for cycle spinning.

Examples

Run this code
# NOT RUN {
v<-runif(10)

#have a look at v:

v

#now shift the values 4 places to the right...

shift(v,4,dir="right")

# }

Run the code above in your browser using DataLab