Learn R Programming

Kmisc (version 0.5.0)

swap_: Swap Elements in a Vector

Description

This function swaps elements in a vector. See examples for usage.

Usage

swap_(vec, ...)

Arguments

vec
the vector of items whose elemetns you will be replacing.
...
A set of named arguments, whereby we translate from names to values of those arguments.

Details

If to is of different type than from, it will be coerced to be of the same type.

See Also

swap

Examples

Run this code
x <- c('a', 'a', 'b', 'c')
swap_(x, a="A")

Run the code above in your browser using DataLab