swap: Replace values in a vector

Description Usage Arguments Value Examples

View source: R/swap.R

Description

Replace values in a vector

Usage

1
swap(vec, from, to)

Arguments

vec

a vector

from

a vector of values that will be replaced in vec, if present

to

a vector of the same length as from, with replacement values for each corresponding element in the same index

Value

a vector of the same length as vec, with values replaced

Examples

1
2
x <- LETTERS[1:10]; print(x)
swap(x, c('J' 'K', 'B'), c('j', 'k', 'b'))

nickfishbane/fishyTools documentation built on May 23, 2019, 4:47 p.m.