Formatted: Some Formats for Nicer Display

Description Usage Arguments Examples

Description

Some predefined formats for nicer display.

Usage

1
2
Formatted(x, style = c("USD", "BRL", "EUR", "Perc"), digits = 2,
  nsmall = 2, decimal.mark = getOption("OutDec"), flag = "")

Arguments

x

a numeric vector.

style

a character name for style. One of "USD", "BRL", "EUR", "Perc".

digits

an integer for the number of significant digits to be used for numeric and complex x

nsmall

an integer for the minimum number of digits to the right of the decimal point.

decimal.mark

decimal mark style to be used with Percents (%), usually (",") or (".").

flag

a character string giving a format modifier as "-", "+", "#".

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
x <- as.double(c(0.1, 1, 10, 100, 1000, 10000))
Formatted(x)

Formatted(x, "BRL")

Formatted(x, "EUR")

p = c(0.25, 25, 50)

Formatted(p, "Perc", flag="+")

Formatted(p, "Perc", decimal.mark=",")

SciencesPo documentation built on May 29, 2017, 9:28 p.m.