View source: R/format_string.R
format_string | R Documentation |
String Values Formatting
format_string(x, ...)
## S3 method for class 'character'
format_string(x, length = NULL, abbreviate = "...", ...)
x |
String value. |
... |
Arguments passed to or from other methods. |
length |
Numeric, maximum length of the returned string. If not
|
abbreviate |
String that will be used as suffix, if |
A formatted string.
s <- "This can be considered as very long string!"
# string is shorter than max.length, so returned as is
format_string(s, 60)
# string is shortened to as many words that result in
# a string of maximum 20 chars
format_string(s, 20)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.