Description Usage Arguments Details Value Examples
t_td forces there to be d digits after the decimal for the numeric input x, without messing with the "integer part" of x; t_sd messes with the integer part (i.e. uses significant digits). Both are vectorized over x.
1 2 3 |
x |
numeric to clean; if not numeric, will be coerced |
d |
number of trailing digits (for t_td) or significant digits (for t_sd) |
commas |
whether to insert commas in the number (the default) |
except |
do not modify these positions of the vector |
t_td ("texhelp trailing digits") returns a character vector version of x, rounded or expanded with trailing digits so that there are exactly d digits after the decimal point. That is, rounding is done or 0s are added to the end as needed.
t_sd ("texhelp significant digits") returns a character vector version of x so that there are exactly d significant digits shown. Trailing zeroes are added as needed, to make the point that there are actually d significant digits.
(In most cases you will want to use t_td in order to force a list of numbers to have the same number of trailing digits – this looks better.)
In both functions, commas are added where necessary; turn off with commas=FALSE.
The except parameter is included to make it painless to deal with the common case of an identifying column for which you do not want trailing digits.
a cleaned charater vector version of the numeric
1 2 |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.