Description Usage Arguments Functions Examples
Simple reusable functions to format numbers
1 2 3 4 5 6 7 | round_mean(x, ndigits = 2)
round_std(x, ndigits = 2)
percent(x, ndigits = 1)
round_exact(x, ndigits = 1)
|
x |
numbers to be converted |
ndigits |
number of digits to which to round the number |
round_mean
: Function to calculate the mean and round to two digits.
round_std
: Function to calculate the standard deviation and round to two digits.
percent
: Function to convert a decimal to a percent, round to a specific number of digits, and convert to a string with a percent sign.
round_exact
: Function to round a number w/ an exact number of digits. Returns a string.
1 2 3 4 | round_mean(mtcars$mpg)
round_exact(2, ndigits = 3)
round_std(mtcars$mpg)
percent(0.157389)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.