print.matrix(x, digits = NULL, quote = T, right = F, abbreviate.labels = F, ...)
length(dim(x))
is 2.
abbreviate.labels
is
TRUE
. If
digits
is not specified,
then the value of
.Options$digits
is used.
TRUE
, character strings are surrounded by quotes.
TRUE
, the contents of the matrix are right justified in the
columns of output.
If
FALSE
, they are left justified.
TRUE
, the column labels are abbreviated (using the function
abbreviate
).
x
, with the invisible flag set to prevent reprinting.
print.matrix
prints
x
as a matrix.
It is called as a result of automatically printing a matrix or a
multi-way array.
A format is chosen for each column, for each page, so that columns line up.
Wide matrices are broken into blocks by choosing as many columns as fit
on one line.
If
x
has a
"dimnames"
attribute,
dimnames(x)[[1]]
provides row
labels, if it has length > 0, and similarly
dimnames(x)[[2]]
provides
column labels.
If it has no
"dimnames"
attribute, row labels are made up to look like row
subscripts (
"[1,]"
, etc.) and column labels are made up to look like column
subscripts (
"[,1]"
, etc).
After each page of output, the column labels are printed again, so that
there should always be a copy of the column labels on the screen
at any time. To avoid multiple copies of the column labels, execute
options(length=10000)
to specify a very long page.
A new format may be chosen at the end of each page.
When
x
is atomic,
print.matrix
allows further control over the
format of the column labels.
If
abbreviate.labels
is
TRUE
, then the column labels are printed in a
shortened form created by the function
abbreviate
. The minimum
length (
minlength
) argument of
abbreviate
is determined by
digits
if
x
is of mode numeric, 2 times
digits
if
x
is complex, or 3
more than the length of the longest element of
x
if
x
is a
character matrix.
If
x
is not atomic,
quote
is always
FALSE
, and
abbreviate.labels
is not used.
state.x77[, 1:4] # produces the following output: Population Income Illiteracy Life Exp Alabama 3615 3624 2.1 69.05 Alaska 365 6315 1.5 69.31 Arizona 2212 4530 1.8 70.55 ... print.matrix(state.x77[,1:8], digits = 3, abb = T) Ppl Inc Ill LEx Mrd HSG Frs Are Alabama 3615 3624 2.1 69.05 15.1 41.3 20 50708 ...