format_number {SparkR}R Documentation

format_number

Description

Formats numeric column y to a format like '#,###,###.##', rounded to x decimal places with HALF_EVEN round mode, and returns the result as a string column.

Usage

format_number(y, x)

## S4 method for signature 'Column,numeric'
format_number(y, x)

Arguments

y

column to format

x

number of decimal place to format to

Details

If x is 0, the result has no decimal point or fractional part. If x < 0, the result will be null.

Note

format_number since 1.5.0

See Also

Other string_funcs: ascii, base64, concat_ws, concat, decode, encode, format_string, initcap, instr, length, levenshtein, locate, lower, lpad, ltrim, regexp_extract, regexp_replace, reverse, rpad, rtrim, soundex, substring_index, translate, trim, unbase64, upper

Examples

## Not run: format_number(df$n, 4)

[Package SparkR version 2.2.2 Index]