set_factor_var: Prepares var and var_label columns for plotting by ordering...

View source: R/rub_plot.R

set_factor_varR Documentation

Prepares var and var_label columns for plotting by ordering them and turning them into factors

Description

Prepares var and var_label columns for plotting by ordering them and turning them into factors

Usage

set_factor_var(df, var, var_label = NULL, reverse = FALSE)

Arguments

df

Data frame

var

Required variable name for the discrete variable to be turned into a factor. This variable is sorted alphabetically to determine the order.

var_label

Optional variable name for the discrete variable labels to be used instead of var. If var is a sort key, for instance, var_label can be used for the actual labels.

reverse

Whether the order of the factor should be reverted, defaults to FALSE.

Value

Data frame with factor column.

Examples

## Not run: 
set_factor_var(df, var, TRUE)

## End(Not run)

RichardMeyer-Eppler/RUBer documentation built on June 2, 2022, 7:24 p.m.