swap: Swap assignment

swapR Documentation

Swap assignment

Description

Swap values simultaneously. Present since hutils 1.4.0.

Usage

x %<->% value

Arguments

x, value

Objects whose values are to be reassigned by swapping.

Value

NULL invisibly. Called for its side-effect: the values of x and value are swapped. So

x %<->% value

is equivalent to

temp <- x
x <- value
value <- temp
rm(temp)

Examples

a <- 1
b <- 2
a %<->% b
a
b


hutils documentation built on April 13, 2022, 5:23 p.m.