stringLength: Change the length of a character string, placing the input...

Description Usage Arguments Value

Description

Change the length of a character string, placing the input string at one end of the output string (if lengthening), or taking one end of the input string only (when shortening). Useful to match lengths of character strings, where inputs vary in length.

Usage

1
stringLength(input, length.out, which = c("head", "tail"), fill = NA)

Arguments

input

A character vector (coerced to character if not already)

length.out

Integer or numerical value for output character length

which

Options "head" (start of string) or "tail" (end of string)

fill

String of any length, used to fill in missing characters where input needs to be lengthened. NA (default) will not lengthen, meaning output strings may be shorter than "length.out". Note that 'fill' is applied outwards from centre.

Value

A vector of character strings, the same vector length as 'input'.


rossholmberg/holmberg documentation built on May 27, 2019, 11:34 p.m.