sep_discrete: Separator for discrete grouped labels

View source: R/scale_manual.R

sep_discreteR Documentation

Separator for discrete grouped labels

Description

This is a function factory that provides a function to split grouped discrete labels into numerical positions.

Usage

sep_discrete(sep = ".", inv = FALSE)

Arguments

sep

A character(1) separator to use for splitting. May not contain regular expressions.

inv

A logical(1) whether to invert the layering of groups.

Value

A function that accepts character input and returns numeric output.

Examples

# Here, 'bar.qux' belongs to the second group, so has +1 value
sep_discrete()(c("foo.bar", "bar.bar", "bar.qux"))

# Now, the values are grouped by the groups before the separator
sep_discrete(inv = TRUE)(c("foo.bar", "bar.bar", "bar.qux"))

ggh4x documentation built on Aug. 31, 2023, 1:08 a.m.