rrv {rrv}R Documentation

Format Money Variables

Description

Format money variables, in a vaguely finance kind of way. This function takes a numeric vector and always returns a character vector. Any non-finite values are returned as NAs. If you want to format a variable in a data.frame object, replace the variable with a formatted character vector (noting this may be turned to a factor), e.g. df$x = money.format (df$x).

Usage

money.format (x, ndec=0, cs=NULL, sep=c (".", ","), br=TRUE, fill=TRUE)

Arguments

x A numeric vector. Can be length zero or contain non-finite values.
ndec Number of decimal places.
cs Currency symbol. Unless null, this should be a character.
sep Character vector of length two, giving the decimal and thousands separators respectively.
br Include brackets around negative numbers for emphasis.
fill Insert empty spaces to beginning and end of the final character vector, to ensure correct alignment.

[Package rrv version 0.0.2 Index]