table_value() casts numeric vectors into character vectors. The main purpose of table_value() is to round and format numeric data for presentation.

table_value(x, rspec = NULL)

Arguments

x

a vector of numeric values.

rspec

a rounding_specification object. If no rspec is given, a default setting will round values to decimal places based on the magnitude of the values.

Value

a vector of character values (rounded numbers).

See also

Other table helpers: table_ester(), table_glue(), table_pvalue()

Examples


table_value(0.123)
#> [1] "0.12"
table_value(1.23)
#> [1] "1.2"
table_value(12.3)
#> [1] "12"

with(mtcars, table_value(disp))
#>  [1] "160" "160" "108" "258" "360" "225" "360" "147" "141" "168" "168" "276"
#> [13] "276" "276" "472" "460" "440" "79"  "76"  "71"  "120" "318" "304" "350"
#> [25] "400" "79"  "120" "95"  "351" "145" "301" "121"