decimal | R Documentation |
decimal() takes any numeric variable with decimal places, and returns its aproximation of decimal places to a given number.
decimal(x, k)
x |
a numeric vector of a single variable |
simple wrapper for 'format(round(x, k), nsmall=k)' function, to format decimal numbers
a string containing a numeric value, with a given number of decimals
number_with_decimals <- .5838
number_with_two_decimals <- decimal(number_with_decimals,2)
# result is .58
number_with_two_decimals
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.