Numeric Values Formatting
format_value(
x,
digits = 2,
protect_integers = FALSE,
missing = "",
width = NULL,
as_percent = FALSE,
...
)
Numeric value.
Number of significant digits.
Should integers be kept as integers (i.e., without decimals)?
Value by which NA
values are replaced. By default, an empty string (i.e. ""
) is returned for NA
.
Minimum width of the returned string. If not NULL
and width
is larger than the string's length, leading whitespaces are added to the string.
Logical, if TRUE
, value is formatted as percentage value.
Arguments passed to or from other methods.
A formatted string.
# NOT RUN {
format_value(1.20)
format_value(1.2)
format_value(1.2012313)
format_value(c(0.0045, 234, -23))
format_value(c(0.0045, .12, .34))
format_value(c(0.0045, .12, .34), as_percent = TRUE)
format_value(as.factor(c("A", "B", "A")))
format_value(iris$Species)
format_value(3)
format_value(3, protect_integers = TRUE)
format_value(iris)
# }
Run the code above in your browser using DataLab