specify_positions: Specify Positions over Grouping Factors

View source: R/S04_Plotting.R

specify_positionsR Documentation

Specify Positions over Grouping Factors

Description

Function to create positions for a figure based on the combination of grouping factors in a data frame.

Usage

specify_positions(dtf, spacing = c(0.25, 0.25), as_list = FALSE)

Arguments

dtf

A data frame with separate columns for each grouping variable.

spacing

A numeric vector of two values, the gap to add between groups and at the beginning and end for plotting limits (given as a proportion).

as_list

Logical; if TRUE returns a list with both the positions and the suggested lower and upper x-axis limits; otherwise, returns the positions as a vector.

Value

A numeric vector of values. If as_list is TRUE, a list with two vectors, one for the positions and one with the lower and upper limits for the plotting boundaries.

Examples

# Example data set
data("mtcars")
dtf <- stats_by_group( mtcars, 'mpg', c( 'vs', 'am' ) )
specify_positions( dtf[, 1:2] )


rettopnivek/arfpam documentation built on Oct. 20, 2024, 7:24 p.m.