Particularly when creating tables, it is often desirable to keep all numbers to the same width. round() and similar functions drop trailing zeros - this version keeps them and thus rounds 1.201 to 1.20 rather than 1.2 when 2 digits are requested.

round_(x, digits = 2)

Arguments

x

Numeric vector to be rounded

digits

Number of significant digits

Value

Character vector of rounded values, with trailing zeroes as needed to show digits figures after the decimal point