powered by
Returns a cyclic shift of numvec so that position x becomes the first element and the order wraps around the end.
numvec
x
vec_permutation(numvec, x = 1)
A numeric vector of the same length as numvec, rotated so that numvec[x] is first.
numvec[x]
Numeric vector representing an ordered cycle.
Integer (1-based) index of the new starting position.
vec_permutation(1:6, 4) # 4 5 6 1 2 3
Run the code above in your browser using DataLab