SparkR (version 2.1.2)

format_number: format_number

Description

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

Usage

format_number(y, x)

# S4 method for 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.

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

Run this code
# NOT RUN {
format_number(df$n, 4)
# }

Run the code above in your browser using DataLab