Round a vector if it is numeric, but return the original vector if it is character.

round_char(x, digits = 0, as_char = FALSE, ...)

Arguments

x

a character vector.

digits

integer indicating the number of decimal places.

as_char

Whether the result should be formatted as a character with trailing 0s (if relevant)

...

arguments to be passed to methods.

Value

The character vector or the rounded version if numeric.