Skip to contents

Move elements to the start of a vector

Usage

moveToFront(x, elements)

Arguments

x

vector

elements

elements out of x to be moved to the front

Value

vector with elements coming first

Examples

moveToFront(1:10, 5)
#>  [1]  5  1  2  3  4  6  7  8  9 10
moveToFront(c("a", "b", "c", "x", "y", "d"), c("x", "y"))
#> [1] "x" "y" "a" "b" "c" "d"