Learn R Programming

formatters (version 0.5.0)

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

Description

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

Usage

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

Value

formatted text representing the cell x.

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".

Details

A length-zero value for na_str will be interpreted as "NA", as will any missing values within a non-length-zero na_str vector.

See Also

round_fmt()

Examples

Run this code

x <- format_value(pi, format = "xx.xx")
x

format_value(x, output = "ascii")

Run the code above in your browser using DataLab