max_pad: Pad a string with the maximum width

View source: R/max_pad.R

max_padR Documentation

Pad a string with the maximum width

Description

Vectorised over string, width and pad. Pad to the maximum width in a string.

Usage

max_pad(string, width = 0, side = c("left", "right", "both"), pad = " ")

Arguments

string

A character vector.

width

Minimum width of padded strings.

side

Side on which padding character is added (left, right or both).

pad

Single padding character (default is a space).

Value

A character vector.

Examples

x <- c("abc", "123456", "defg")

max_pad(x) 
max_pad(x, side = "right") 
max_pad(x, pad = "0") 
max_pad(x, side = "right", pad = "0") 
max_pad(x, side = "both", pad = "0") 

emilelatour/lamisc documentation built on April 9, 2024, 10:33 a.m.