move_elt: Manipulate positions, rows, and columns

View source: R/move.R

move_eltR Documentation

Manipulate positions, rows, and columns

Description

Manipulate positions, rows, and columns

Usage

move_elt(x, from, to)

move_val(x, val, to)

move_row(x, from, to)

move_col(x, from, to)

Arguments

x

For move_elt and move_val an atomic vector. A data.frame or matrix for all others.

from

Whole-number scalar indexing the element, row, or column to be moved. Negative values index from the last position, row or column.

to

Whole-number scalar indexing the element, row, or column to be moved into. Negative values index from the last position, row or column.

val

A non-NA atomic scalar value found in x.

Details

  move_val Move value val of x into the from-th element of x. Assumes length(which(x == val)) == 1.
   
  move_elt Move the value in the from-th position of x to the to-th position of x.
   
  move_row Move the from-th row of x to the to-th row of x.
   
  move_col Move the from-th column of x to the to-th column of x.

from < 0 and to < 0 index from the last position, row, or column rather than the first.

Value

An object of the same class and dimension as x.


j-martineau/uj documentation built on Sept. 14, 2024, 4:40 a.m.