utf8_format | R Documentation |
Format a character object for UTF-8 printing.
utf8_format(
x,
...,
trim = FALSE,
chars = NULL,
justify = "left",
width = NULL,
na.encode = TRUE,
quote = FALSE,
na.print = NULL,
print.gap = NULL,
utf8 = NULL
)
x |
character object. |
... |
These dots are for future extensions and must be empty. |
trim |
logical scalar indicating whether to suppress padding spaces around elements. |
chars |
integer scalar indicating the maximum number of character units
to display. Wide characters like emoji take two character units; combining
marks and default ignorables take none. Longer strings get truncated and
suffixed or prefixed with an ellipsis ( |
justify |
justification; one of |
width |
the minimum field width; set to |
na.encode |
logical scalar indicating whether to encode |
quote |
logical scalar indicating whether to format for a context with
surrounding double-quotes ( |
na.print |
character string (or |
print.gap |
non-negative integer (or |
utf8 |
logical scalar indicating whether to format for a UTF-8 capable
display (ASCII-only otherwise), or |
utf8_format()
formats a character object for printing, optionally
truncating long character strings.
A character object with the same attributes as x
but with
Encoding
set to "UTF-8"
for elements that can be converted to
valid UTF-8 and "bytes"
for others.
utf8_print()
, utf8_encode()
.
# the second element is encoded in latin-1, but declared as UTF-8
x <- c("fa\u00E7ile", "fa\xE7ile", "fa\xC3\xA7ile")
Encoding(x) <- c("UTF-8", "UTF-8", "bytes")
# formatting
utf8_format(x, chars = 3)
utf8_format(x, chars = 3, justify = "centre", width = 10)
utf8_format(x, chars = 3, justify = "right")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.