powered by
Round numeric values to an exact number of digits and return as a character
round2char(x, digits = 3, na_replace = "", omit_leading_zero = FALSE)
A vector of rounded numbers converted to characters
Numeric values
Number of digits to which result should be rounded
Scalar value: Character with which NA values should be replaced
Logical scalar determining whether to omit leading zeros (TRUE) or retain them (FALSE; default).
TRUE
FALSE
# round2char(x = .50000005) # round2char(x = NA, na_replace = "---")
Run the code above in your browser using DataLab