Description Usage Arguments Value Note Examples
Shorten strings to a given number of characters
1 | shortenStr(str, nchar = 8)
|
str |
A vector of strings |
nchar |
The maximal number of characters to keep |
A vector of strings of the same length as the input, with each string shortened to the desired length
Strings with more characters than nchar
will be shortened.
NA
will be kept as they are
1 2 3 | inputStrs <- c("abc", "abcd", "abcde", NA)
shortenStr(inputStrs, nchar=4)
## expected outcome: abc, abcd, abcd..., NA
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.