Learn R Programming

diceplot (version 0.1.7)

create_var_positions: Create Variable Positions

Description

Generates a data frame containing variable names from cat_c_colors and corresponding x and y offsets based on the number of variables.

Usage

create_var_positions(cat_c_colors, num_vars)

Value

A data frame with columns:

var

Factor of variable names from cat_c_colors.

x_offset

Numeric x-axis offset for plotting.

y_offset

Numeric y-axis offset for plotting.

Arguments

cat_c_colors

A named vector of colors for variables in category C. The names correspond to variable names.

num_vars

The number of variables. Supported values are "3", "4", "5", or "6".

Examples

Run this code
library(dplyr)
cat_c_colors <- c("Var1" = "red", "Var2" = "blue", "Var3" = "green")
create_var_positions(cat_c_colors, 3)

Run the code above in your browser using DataLab