cranvas (version 0.8.5)

switch_value: Switch the values of two variables

Description

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

Usage

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

Value

NULL

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.

See Also

get, assign

Examples

Run this code
x1 <- 4:9
x2 <- letters
switch_value("x1", "x2")
x1
x2

Run the code above in your browser using DataLab