View source: R/sprintf-ca-function.R
sprintf.ca | R Documentation |
This is a variation of sprintf, that checks if the formated result is too long. This can happen, for example, with electrometer output, where normal results are 0.004 pC and then an overflow gives a charge of 6e47 C, which produces an output that ruins txtplot table output.
sprintf.ca("%.5f", c(1.23, 2.33, 1e99), max.chars=7)
format |
is the main format (e.g. "%.5f") which is used if the output does not require too many characters. |
number |
to print (e.g. 1.334 or 1.4e99). |
format.alt |
is the alternative format (e.g. "%.4e") which is used for output that require too many characters. |
max.char |
is the maximum number of characters (e.g. 10) that the main format needs to fit (otherwise the alternative format will be used). |
formated number.
Claus E. Andersen
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.