Prettifies a numeric vector by rounding, separating thousands and optionally other procedures. Basically a convenience wrapper around round_to()
and
base::format()
.
Usage
prettify_nr(
x,
round_to = 0.1,
round_up = TRUE,
big_mark = "'",
decimal_mark = ".",
justify_right = FALSE,
...
)
Arguments
- x
A numeric vector to prettify.
- round_to
Number to round
x
to. A numeric scalar.- round_up
Whether to round a remainder of exactly
to / 2
up or not. Set toFALSE
in order to round off.- big_mark
Character used between every 3 digits to separate thousands.
- decimal_mark
Character used to indicate the numeric decimal point. Only relevant if
x
does not solely consist of integers.- justify_right
Whether to right-justify the results to a common width. See the
trim
parameter ofbase::format()
for details.- ...
Further arguments passed on to
base::format()
.
See also
Other string functions:
as_chr()
,
as_comment_str()
,
as_line_feed_chr()
,
as_str()
,
capitalize_first()
,
dsv_colnames()
,
enum_str()
,
escape_lf()
,
fuse_regex()
,
sentenceify()
,
wrap_chr()