format_number | R Documentation |
Pastes formatted x
if numeric, otherwise x
unmodified.
Circumvents R's automatic scientific notation.
If a number is nearly whole (see is_nearly_whole()
), it is rounded to have
zero decimal places. Otherwise, numbers >= 1 are rounded to 1 decimal place;
numbers < 1 are rounded to have 2 significant digits.
format_number(x, nsmall = 1, signif_precise = 2)
x |
inline code |
nsmall |
number of digits after the decimal point to round to when |
signif_precise |
number of significant digits to use when |
formatted x
if numeric, otherwise x
unmodified.
Pat Schloss pschloss@umich.edu
Kelly Sovacool sovacool@umich.edu
format_number(0.0256)
format_number(.Machine$double.eps^0.5)
format_number(100000.08)
format_number(1.00000000000000000001)
format_number("this is a string")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.