Converts a (possibly compound) value into a string using the format information

format_value(x, format = NULL, output = c("ascii", "html"), na_str = "NA")

Arguments

x

ANY. The value to be formatted

format

character(1) or function. The format label (string) or formatter function to apply to x.

output

character(1). output type

na_str

character(1). String that should be displayed when the value of x is missing. Defaults to "NA".

Value

formatted text representing the cell x.

See also

[round_fmt()]

Examples


x <- format_value(pi, format = "xx.xx")
x
#> [1] "3.14"

format_value(x, output = "ascii")
#> [1] "3.14"