View source: R/utilities-labels.R
sprintf_dm | R Documentation |
Using sprintf
flexibly format numbers as character strings
encoded for parsing into R expressions or using LaTeX or markdown
notation.
sprintf_dm(fmt, ..., decimal.mark = getOption("OutDec", default = "."))
value2char(
value,
digits = Inf,
format = "g",
output.type = "expression",
decimal.mark = getOption("OutDec", default = ".")
)
fmt |
character as in |
... |
as in |
decimal.mark |
character If |
value |
numeric The value of the estimate. |
digits |
integer Number of digits to which numeric values are formatted. |
format |
character One of "e", "f" or "g" for exponential, fixed, or significant digits formatting. |
output.type |
character One of "expression", "latex", "tex", "text", "tikz", "markdown". |
These functions are used to format the character strings returned,
which can be used as labels in plots. Encoding used for the formatting is
selected by the argument passed to output.type
, thus, supporting
different R graphic devices.
sprintf
sprintf_dm("%2.3f", 2.34)
sprintf_dm("%2.3f", 2.34, decimal.mark = ",")
value2char(2.34)
value2char(2.34, digits = 3, format = "g")
value2char(2.34, digits = 3, format = "f")
value2char(2.34, output.type = "text")
value2char(2.34, output.type = "text", format = "f")
value2char(2.34, output.type = "text", format = "g")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.