add_spaces: Add spaces

View source: R/rbitr_helpers.R

add_spacesR Documentation

Add spaces

Description

Justify table columns by adding spaces.

Usage

add_spaces(my_text, to)

Arguments

my_text

A character vector of text to be justified.

to

A single-element character vector with allowed values of either 'head' or 'tail' to indicate on which side spaces should be added.

Details

The function add_spaces() is used to make justified tables with a monospaced font. The parameter my_text should contain a vector of text for a single column, with each row as a separate element. For right- justified text, set the to parameter to 'head'. This will add enough space to the front of each row to make all entries have an equal number of characters. Similarly, for left-justified text, set the to parameter to 'tail'.

Value

A character vector of text with spaces added to give each entry an equal number of characters.

Examples

add_spaces(c('a', 'b', 'cccc'), to = 'tail')

dryguy/rbitr documentation built on Oct. 15, 2024, 6:18 a.m.