Description Usage Arguments Value
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.
1 | stringLength(input, length.out, which = c("head", "tail"), fill = NA)
|
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. |
A vector of character strings, the same vector length as 'input'.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.