cranvas (version 0.8.5)

break_str: Insert line breaks into character strings

Description

By default, all the non-alphanumeric characters are replaced by '\n', which can be useful when plotting long axis labels, e.g., in parallel coordinates plots.

Usage

break_str(x, split = "[^[:alnum:]]", ...)

Arguments

x
a character vector
split
the rule (regular expression) to replace characters by line breaks
...
other arguments passed to gsub

Value

a character vector with certain characters replaced by '\n'

Examples

Run this code
break_str(c("long label1.1", "long label1.2", "long label1.3"), split = " ")
break_str(names(iris))

Run the code above in your browser using DataCamp Workspace