fixWidthStr: Shorten strings to strings with a fix width of characters

Description Usage Arguments Value Note See Also Examples

View source: R/string.R

Description

Shorten strings to strings with a fix width of characters

Usage

1
fixWidthStr(str, nchar = 8, align = c("left", "right"))

Arguments

str

A vector of strings

nchar

The fixed with

align

Character, how to align Strings with more or fewer characters than nchar are either shortened or filled (with spaces)

Value

A vector of strings with fixed widths

Note

NA will be converted to characters and the same fixed width will be applied. The behavior is different from shortenStr, where NA is kept as it is.

See Also

shortenStr

Examples

1
2
3
inputStrs <- c("abc", "abcd", "abcde", "abcdefg", "NA", NA) 
outputStrs <- fixWidthStr(inputStrs, nchar=4)
stopifnot(all(nchar(outputStrs)==4))

ribiosUtils documentation built on March 13, 2020, 2:54 a.m.