]> git.donarmstrong.com Git - xtable.git/blob - pkg/R/xtableFtable.R
Incomplete version of xtableFtable.R
[xtable.git] / pkg / R / xtableFtable.R
1 ### ftable objects, requested by Charles Roosen
2 ### Feature request #2248, 2/9/2012
3 xtableFtable <- function(x, caption = NULL, label = NULL, align = NULL,
4                          digits = NULL, display = NULL, auto = FALSE,
5                          quote = TRUE,
6                          method = c("non.compact", "row.compact",
7                                     "col.compact", "compact"),
8                          lsep = " | ", ...) {
9   ftbl <- format.ftable(x, quote = quote, digits = digits,
10                         method = method, lsep = lsep)
11   xftbl <- xtable.matrix(ftbl,
12                          caption = caption, label = label, align = align,
13                          digits = digits, display = display, auto = auto)
14   class(xftbl) <- c("xtableFtable", "data.frame")
15   attributes(xftbl) <- list(attributes(xftbl), attributes(ftbl))
16   return(xftbl)
17 }
18
19 print.xtableFtable <- function(x,
20   type = getOption("xtable.type", "latex"),
21   file = getOption("xtable.file", ""),
22   append = getOption("xtable.append", FALSE),
23   floating = getOption("xtable.floating", TRUE),
24   floating.environment = getOption("xtable.floating.environment", "table"),
25   table.placement = getOption("xtable.table.placement", "ht"),
26   caption.placement = getOption("xtable.caption.placement", "bottom"),
27   caption.width = getOption("xtable.caption.width", NULL),
28   latex.environments = getOption("xtable.latex.environments", c("center")),
29   tabular.environment = getOption("xtable.tabular.environment", "tabular"),
30   size = getOption("xtable.size", NULL),
31   hline.after = getOption("xtable.hline.after", NULL),
32   NA.string = getOption("xtable.NA.string", ""),
33   only.contents = getOption("xtable.only.contents", FALSE),
34   add.to.row = getOption("xtable.add.to.row", NULL),
35   sanitize.rownames.function = getOption("xtable.sanitize.rownames.function",
36                                          sanitize.text.function),
37   sanitize.colnames.function = getOption("xtable.sanitize.colnames.function",
38                                          sanitize.text.function),
39   math.style.negative = getOption("xtable.math.style.negative", FALSE),
40   math.style.exponents = getOption("xtable.math.style.exponents", FALSE),
41   html.table.attributes = getOption("xtable.html.table.attributes", "border=1"),
42   print.results = getOption("xtable.print.results", TRUE),
43   format.args = getOption("xtable.format.args", NULL),
44   rotate.rownames = getOption("xtable.rotate.rownames", FALSE),
45   rotate.colnames = getOption("xtable.rotate.colnames", FALSE),
46   booktabs = getOption("xtable.booktabs", FALSE),
47   scalebox = getOption("xtable.scalebox", NULL),
48   width = getOption("xtable.width", NULL),
49   comment = getOption("xtable.comment", TRUE),
50   timestamp = getOption("xtable.timestamp", date()),
51   ...) {
52   if (type == "latex"){
53     if (is.null(align) {
54       align <- c(rep("r", nRowVars)
55     } else {
56     stop("print.xtableFtable not yet implemented for this type")
57   }
58 }
59