.sprintf_dp | R Documentation |
'sprintf' will respect decimal point conventions only if you switch locale. This is unwieldy and not in line with 'format'. This wrapper around 'sprintf' replaces decimal points with a 'sep' character of your choice, sensible choices for which are ',' or 'UTF8+00B7'. It will not try and replace things that are not syntactially numbers.
.sprintf_dp(fmt, ..., sep = getOption("OutDec", "."))
fmt |
a sprintf format string |
... |
Arguments passed on to |
sep |
a character to use a decimal point. |
the formatted string with decimal points as specified
try({
.sprintf_dp("%1.2f",1:3/3, sep="\u00B7")
.sprintf_dp("%1.2f-%1.2f", 1:3/3, 1:3, sep="\u00B7")
.sprintf_dp("%s %1.2f-%1.2f", "A.1.2", 1:3/3, 1:3, sep="\u00B7")
})
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.