format.df {Hmisc} | R Documentation |
format.df
does appropriate rounding and decimal alignment, and outputs
a character matrix containing the formatted data. If x
is a
data.frame
, then do each component separately.
If x
is a matrix, but not a data.frame, make it a data.frame
with individual components for the columns.
If a component x$x
is a matrix, then do all columns the same.
format.df(x, digits, dec=NULL, rdec=NULL, cdec=NULL, numeric.dollar=!dcolumn, na.blank=FALSE, na.dot=FALSE, blank.dot=FALSE, col.just=NULL, cdot=FALSE, dcolumn=FALSE, matrix.sep=' ', scientific=c(-4,4), math.row.names=FALSE, math.col.names=FALSE, double.slash=FALSE, ...)
x |
a matrix (usually numeric) or data frame |
digits |
causes all values in the table to be formatted to |
dec |
If |
rdec |
a vector specifying the number of decimal places to the right for each row
( |
cdec |
a vector specifying the number of decimal places for each column. The vector must have number of items equal to number of columns or components of input x. |
cdot |
Set to |
na.blank |
Set to |
dcolumn |
Set to \usepackagemust reference [dcolumn]. The three files ‘dcolumn.sty’, ‘newarray.sty’, and ‘array.sty’ will need to be in a directory in your TEXINPUTS path. When you use dcolumn=TRUE , numeric.dollar should be set to FALSE .
|
numeric.dollar |
logical, default |
math.row.names |
logical, set true to place dollar signs around the row names. |
math.col.names |
logical, set true to place dollar signs around the column names. |
na.dot |
Set to |
blank.dot |
Set to |
col.just |
Input vector \tabularenvironment and the letters l, r, and c are valid values. When format.df is called by
SAS, the col.just is used to determine whether a
\$ is needed on the input line of the ‘sysin’ file,
and the letters l and r are valid values.
|
matrix.sep |
When |
scientific |
specifies ranges of exponents (or a logical vector) specifying values
not to convert to scientific notation. See |
double.slash |
should escaping backslashes be themselves escaped. |
... |
other arguments are accepted and ignored. For |
a character matrix with character images of properly rounded x
.
Matrix components of input x
are now just sets of columns of
character matrix.
Object attribute"col.just"
repeats the value of the argument col.just
when provided,
otherwise, it includes the recommended justification for columns of output.
See the discussion of the argument col.just
.
The default justification is l for characters and factors,
r for numeric.
When dcolumn==TRUE
, numerics will have . as the justification character.
Frank E. Harrell, Jr.,
Department of Biostatistics,
Vanderbilt University,
f.harrell@vanderbilt.edu
Richard M. Heiberger,
Department of Statistics,
Temple University, Philadelphia, PA.
rmh@astro.ocis.temple.edu
## Not run: x <- data.frame(a=1:2, b=3:4) x$m <- matrix(5:8,nrow=2) names(x) dim(x) x format.df(x) dim(format.df(x)) ## End(Not run)