valign: Vertically Align Strings

View source: R/functions.R

valignR Documentation

Vertically Align Strings

Description

Vertically align character vectors.

Usage

valign(s, align = "|", insert.at = "<>", replace = TRUE, fixed = TRUE)

Arguments

s

a character vector

align

a regular expression

insert.at

a regular expression

replace

logical

fixed

logical

Details

The function expands the elements of a character vector in such a way that the elements are vertically aligned, which can be handy when generating reports. See Examples.

Value

a character vector

Author(s)

Enrico Schumann

See Also

strwrap, format

Examples

s <- c("Player 1 <>| 100",
       "another player <>| 999999")

cat(paste(s, collapse = "\n"))
## Player 1 <>| 100
## another player <>| 999999

cat(paste(valign(s), collapse = "\n"))
## Player 1        100
## another player  999999


textutils documentation built on May 29, 2024, 10:37 a.m.