Closed jeromyanglim closed 12 years ago
As per this post the following will force two digits
format(round(x, 2), nsmall = 2)
And here's a function that takes a numeric variable and a specified number of digits
force_digits <- function(x, digits=2) format(round(x, digits), nsmall = digits)
As per this post the following will force two digits
And here's a function that takes a numeric variable and a specified number of digits