Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

align

Alignment helper


Description

Facilitates easy alignment of strings within a character vector. Designed to help implementers of formatters for custom data types.

Usage

align(x, width = NULL, align = c("left", "right"), space = " ")

Arguments

x

A character vector

width

The width that each string is padded to. If NULL, the maximum display width of the character vector is used (see get_max_extent()).

align

How should strings be aligned? If align = left then padding appears on the right, and vice versa.

space

What character should be used for the padding?

Examples

align(c("abc", "de"), align = "left")
align(c("abc", "de"), align = "right")

pillar

Coloured Formatting for Columns

v1.6.0
MIT + file LICENSE
Authors
Kirill Müller [aut, cre], Hadley Wickham [aut], RStudio [cph]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.