Format Atomic Data

DESCRIPTION:
Returns an object of character strings representing the input data. For numeric data there are several options such as the control of scientific notation, the type of justification, and the insertion of marks.

USAGE:
format.default(x, decimal.mark=".", scientific=c(-4, 4),
           digits=.Options$digits, big.mark="", big.interval=3,
           small.mark="", small.interval=5, nsmall=NULL,
           justify="decimal", decimal.mark=".")

REQUIRED ARGUMENTS:
x:
an atomic object.
Missing values (NA) are allowed.

OPTIONAL ARGUMENTS:
scientific:
logical vector, or numeric vector of length two indicating which numbers are to be represented in scientific notation. If logical, then it is replicated to be the length of x. If numeric, then numbers with exponents strictly within this range will not be printed in scientific notation.
digits:
the maximum number of (significant) digits to use.
big.mark:
the mark with which to group the digits to the left of the decimal.
big.interval:
the number of digits in a group to the left of the decimal.
small.mark:
the character used to group digits to the right of the decimal.
small.interval:
the number of digits in a group to the right of the decimal.
nsmall:
the minimum number of digits to appear to the right of the decimal.
justify:
character string giving the justification of the numbers relative to each other. The choices are "none", "left", "right" and "decimal". Only the first letter needs to be given.
decimal.mark:
the character to put at the decimal place (between the one's place and the one-tenth's place).

VALUE:
an object like x, but of mode "character".

DETAILS:
If given the single argument x, format.default takes all elements of x and turns them into character form using a common format, just as they would be printed by the print.atomic function. This ensures that all elements of the value have the same number of characters and have decimal places aligned. If more than one argument is given and x is numeric, then the result will vary from that produced by print.atomic.

If justify is set to "none", then there are no spaces around the numbers. In all other cases, the number of characters in each string is equal. For "left" all of the spaces are at the end of the strings; for "right" all spaces are at the beginning; and the "decimal" option may place spaces both at the beginning and at the end in order to have all of the decimal places line up.


SEE ALSO:
format , print , write .

EXAMPLES:
format(hstart,scientific=T, nsmall=3)
format(pnorm(2:7), nsmall=15, digits=15, small.mark=" ")
format(c(1e6,2.3e6), nsmall=2, scientific=F)

# francais format(c(1e6,2.3e6), nsmall=2, scientific=F, decimal=",", big.mark=".")