switch_value: Switch the values of two variables

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/utils.R

Description

The values of two variables a and b are switched in an environment envir.

Usage

1
switch_value(a, b, envir = .GlobalEnv)

Arguments

a

the name of the first variable (character)

b

the name of the second variable (character)

envir

the environment of the variables a and b

Details

This function can make it a little bit easier when a plot can be drawn vertically and horizontally, in which case we only need to switch some attributes in the x-axis and y-axis, and the code for actual drawing is not affected. The bar plot is such an example.

Value

NULL

Author(s)

Yihui Xie <http://yihui.name>

See Also

get, assign

Examples

1
2
3
4
5
x1 <- 4:9
x2 <- letters
switch_value("x1", "x2")
x1
x2

ggobi/cranvas documentation built on May 17, 2019, 3:10 a.m.