| .round | R Documentation |
Rounds numbers to the specified number of decimal places. Unlike round, it
handles NULL inputs gracefully by returning NULL and optionally prints a warning.
.round(x, digits = 0, verbose = FALSE)
x |
Numeric vector or NULL. |
digits |
Integer indicating the number of decimal places to round to. |
verbose |
Logical; if |
Rounded number or NULL if input is NULL.
roundSafe(3.14159, digits = 2)
roundSafe(NULL) # returns NULL with a warning
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.