Learn R Programming

multicolor (version 0.1.7)

triangle_string: Turn strings into triangle-shaped strings

Description

Turn strings into triangle-shaped strings

Usage

triangle_string(string, maxlen = 1, step = 1, display = FALSE)

Value

A string

Arguments

string

(character) Some text to reshape into a triangle.

maxlen

(integer) Width of top of triangle. Defaults to 1. Set larger than 1 for downward-pointing triangle.

step

(integer) Number of characters to expand or contract triangle width per line (set to negative for downward-pointing triangle)

display

(logical) Returns string invisibly if FALSE (default), set to TRUE to display returned string

Details

Use positive step argument for upward pointing triangle and negative step and wider maxlen for downward pointing triangle.

Examples

Run this code
triangle_string("hellooooooooooooooooooooooooooooooooooooooooooooooooooo world") %>%
  multi_color()

Run the code above in your browser using DataLab