"xtableFtable", "print.xtableFtable",
"toLatex.xtable",
"autoformat", "xalign", "xdigits", "xdisplay",
- "sanitize", "sanitize.numbers", "sanitize.final", "as.is", "as.math",
- "format.ftable")
+ "sanitize", "sanitize.numbers", "sanitize.final", "as.is", "as.math")
S3method("print", "xtable")
S3method("print", "xtableMatharray")
S3method("display<-", "xtable")
S3method("display", "xtable")
-S3method("format", "ftable")
-
S3method("xtable", "data.frame")
S3method("xtable", "matrix")
S3method("xtable", "table")
xtableList and print.xtableList; and 'The Other Packages Gallery'
to illustrate methods for classes of objects from other packages.
-1.8-0
+1.8-0 (2015-11-02)
* autoformat, xalign, xdigits, xdisplay from Arni Magnusson, added
along with help file. Feature request #5686.
* New argument 'auto' in xtable(), to call xalign, xdigits, and
timestamp = getOption("xtable.timestamp", date()),
...) {
if (type == "latex"){
-
+ ## extract the information in the attributes
caption <- attr(x, "ftableCaption")
label <- attr(x, "ftableLabel")
align <- attr(x, "ftableAlign")
nCharCols <- attr(x, "nChars")[2]
nRowVars <- length(attr(x, "row.vars"))
nColVars <- length(attr(x, "col.vars"))
- fmtFtbl <- format.ftable(x, quote = quote, digits = digits,
- method = method, lsep = lsep)
+
+ ## change class so format method will find format.ftable
+ ## even though format.ftable is not exported from 'stats'
+ class(x) <- "ftable"
+ fmtFtbl <- format(x, quote = quote, digits = digits,
+ method = method, lsep = lsep)
attr(fmtFtbl, "caption") <- caption
attr(fmtFtbl, "label") <- label
- ## if method is "compact", rotate both if either requested
- ## if (method == "compact"){
- ## if (rotate.rownames) rotate.colnames <- TRUE
- ## if (rotate.colnames) rotate.rownames <- TRUE
- ## }
## sanitization is possible for row names and/or column names
## row names
}
}
+## format.xtableFtable <- function(x, quote = TRUE, digits = getOption("digits"),
+## method = c("non.compact", "row.compact",
+## "col.compact", "compact"),
+## lsep = " | ", ...){
+## class(x) <- "ftable"
+
+## format(x, quote = quote, digits = digits,
+## method = method, lsep = lsep, ...)
+## }
\code{print.xtableFtable} uses the attributes attached to an object
of class \code{c("xtableFtable", "ftable")} to create a suitable
- character matrix object for subsequent printing via a call to
- \code{stats:::format.ftable}. This matrix object is then printed via
- a call to \code{print.xtable}.
+ character matrix object for subsequent printing. Formatting is
+ carried out by changing the class of the \code{c("xtableFtable",
+ "ftable")} to \code{"ftable"} then using the generic \code{format}
+ to invoke \code{format.ftable}, from the \pkg{stats} package. The
+ matrix object produced is then printed via a call to
+ \code{print.xtable}.
Note that at present there is no code for \code{type = "html"}.
}
produced by the default formatting.\r
\r
<<results='asis'>>=\r
+data(mtcars)\r
dat <- mtcars[1:3, 1:6]\r
x <- xtable(dat)\r
x\r