Learn R Programming

relevance (version 2.1)

shortenstring: Shorten Strings

Description

Strings are shortened if they are longer than n

Usage

shortenstring(x, n = 50, endstring = "..", endchars = NULL)

Value

Abbreviated string(s)

Arguments

x

a string or a vector of strings

n

maximal character length

endstring

string(s) to be appended to the shortened strings

endchars

number of last characters to be shown at the end of the abbreviated string. By default, it adjusts to n.

Author

Werner A. Stahel

See Also

Examples

Run this code
shortenstring("abcdefghiklmnop", 8)

shortenstring(c("aaaaaaaaaaaaaaaaaaaaaa","bbbbc",
  "This text is certainly too long, don't you think?"),c(8,3,20))

Run the code above in your browser using DataLab