str_align: Align a vector of character strings

Description Usage Arguments Value Examples

View source: R/str-.R

Description

Align a vector of character strings by padding appropriately with spaces. Naturally fails hopelessly if the text is rendered in a non-monospace font.

Usage

1
str_align(x, align = c("left", "right", "center"))

Arguments

x

A character vector.

align

A string specifying alignment.

Value

x with all elements padded to the maximum width and aligned

Examples

1
2
3
4
x <- c("short", "medium length", "and a rather long string")
str_align(x, "left")
str_align(x, "right")
str_align(x, "center")

fbc-studies/fbcutils documentation built on May 7, 2019, 7:41 a.m.