Learn R Programming

vbracket (version 1.1.0)

add_bracket_comparisons: Create comparison specification for vbracket

Description

Helper function to create a properly formatted comparison data frame for use with guide_legend_bracket().

Usage

add_bracket_comparisons(..., groups1 = NULL, groups2 = NULL, labels = NULL)

Value

A data frame with columns: group1, group2, label

Arguments

...

Named arguments or list of comparisons. Each comparison can be:

  • A character vector of length 3: c(group1, group2, label)

  • A named list: list(from = "A", to = "B", label = "***")

groups1

Character vector of first groups to compare.

groups2

Character vector of second groups to compare.

labels

Character vector of significance labels.

Examples

Run this code
# Using individual vectors
add_bracket_comparisons(
  groups1 = c("A", "C"),
  groups2 = c("B", "D"),
  labels = c("***", "ns")
)

# Using ... with vectors
add_bracket_comparisons(
  c("A", "B", "***"),
  c("C", "D", "ns")
)

Run the code above in your browser using DataLab