
Last chance! 50% off unlimited learning
Sale ends in
print.char.matrix(x, file = "", col.name.align = "cen", col.txt.align = "right",
cell.align = "cen", hsep = "|", vsep = "-", csep = "+", row.names = TRUE,
col.names = FALSE, append = FALSE,
top.border = TRUE, left.border = TRUE, ...)
"cen"
results in names centred
between the sides of the columns they name. If the width of the text
in the columns is less than the width of the name, col.name.align
with no effect when the width of
the column is greater than its name.hsep
is more than one character,
csep
will need to be the same length. There is no provision
for multiple vertical separators""
, are we appending to
the file or overwriting?x
is a mixture of character and numeric, the
distinction between character and numeric columns will be lost. This
is especially so if the matrix is of a form where you would not want
to print the column names, the column information being in the rows at
the beginning of the matrix. Row names, if not specified in the making of the matrix will simply be
numbers. To prevent printing them, set row.names = FALSE
.
write
, write.table
data(HairEyeColor)
print.char.matrix(HairEyeColor[ , , "Male"], col.names = TRUE)
print.char.matrix(HairEyeColor[ , , "Female"], col.txt.align = "left", col.names = TRUE)
z <- rbind(c("", "N", "y"),
c("[ 1.34,40.3)
[40.30,48.5)
[48.49,58.4)
[58.44,87.8]",
"50
50
50
50",
"0.530
0.489
0.514
0.507"),
c("female
male", "94
106", "0.552
0.473" ),
c("", "200", "0.510"))
dimnames(z) <- list(c("", "age", "sex", "Overall"),NULL)
print.char.matrix(z)
Run the code above in your browser using DataLab