round_and_format: Rounds and formats in the same function

Description Usage Arguments Value Author(s)

View source: R/round_and_format.R

Description

round_and_format rounds and formats a numeric vector. This is useful for providing output for tables or plots in a standardized format.

Usage

1
2
3
4
5
6
7
round_and_format(
  x,
  digits = 2,
  sign_digits = NULL,
  scientific = FALSE,
  trim = TRUE
)

Arguments

x

A numeric vector.

digits

Number of decimal places.

sign_digits

Number of significant digits (if given this overrides digits).

scientific

logical: whether encoding should be in scientific notation or not.

trim

logical: if leading blanks for justification to common width should be excluded or not.

Value

Rounded and formatted values as characters.

Author(s)

Geir H. Bolstad


evolvability documentation built on Dec. 11, 2021, 9:34 a.m.