dimnames = list(rownames(x),
names(dimnames(x)))),
caption = caption, label = label, align = align,
- digits = digits, display = display, auto = auto))
+ digits = digits, display = display, auto = auto, ...))
} else if (length(dim(x))==2) {
return(xtable.matrix(matrix(x, ncol = dim(x)[2], nrow = dim(x)[1],
dimnames = list(rownames(x), colnames(x))),
caption = caption, label = label, align = align,
- digits = digits, display = display, auto = auto))
+ digits = digits, display = display, auto = auto, ...))
} else {
stop("xtable.table is not implemented for tables of > 2 dimensions")
}
digits = NULL, display = NULL, auto = FALSE, ...) {
return(xtable.anova(anova(x, ...), caption = caption, label = label,
align = align, digits = digits, display = display,
- auto = auto))
+ auto = auto, ...))
}
xtable.summary.aov <- function(x, caption = NULL, label = NULL, align = NULL,
digits = NULL, display = NULL, auto = FALSE,
...) {
return(xtable.anova(x[[1]], caption = caption, label = label, align = align,
- digits = digits, display = display, auto = auto))
+ digits = digits, display = display, auto = auto, ...))
}
xtable.summary.aovlist <- function(x, caption = NULL, label = NULL,
result <- xtable.summary.aov(x[[i]], caption = caption,
label = label,
align = align, digits = digits,
- display = display, auto = auto)
+ display = display, auto = auto, ...)
} else {
result <- rbind(result,
xtable.anova(x[[i]][[1]], caption = caption,
label = label, align = align,
digits = digits, display = display,
- auto = auto))
+ auto = auto, ...))
}
}
return(result)
digits = NULL, display = NULL, auto = FALSE, ...) {
return(xtable.summary.aovlist(summary(x), caption = caption, label = label,
align = align, digits = digits,
- display = display, auto = auto))
+ display = display, auto = auto, ...))
}
digits = NULL, display = NULL, auto = FALSE, ...) {
return(xtable.summary.lm(summary(x), caption = caption, label = label,
align = align, digits = digits, display = display,
- auto = auto))
+ auto = auto, ...))
}
xtable.summary.lm <- function(x, caption = NULL, label = NULL, align = NULL,
digits = NULL, display = NULL, auto = FALSE, ...) {
return(xtable.summary.glm(summary(x), caption = caption,
label = label, align = align,
- digits = digits, display = display, auto = auto))
+ digits = digits, display = display,
+ auto = auto, ...))
}
xtable.summary.glm <- function(x, caption = NULL, label = NULL, align = NULL,
digits = NULL, display = NULL, auto = FALSE,
...) {
return(xtable.summary.lm(x, caption = caption, label = label, align = align,
- digits = digits, display = display, auto = auto))
+ digits = digits, display = display,
+ auto = auto, ...))
}
c("coef", "exp(coef)", "robust se", "z", "p"))
}
return(xtable(tmp, caption = caption, label = label, align = align,
- digits = digits, display = display, auto = auto))
+ digits = digits, display = display, auto = auto, ...))
}
### Additional method: xtable.ts
names(tmp) <- COLNAMES
}
return(xtable(tmp, caption = caption, label = label, align = align,
- digits = digits, display = display, auto = auto))
+ digits = digits, display = display, auto = auto, ...))
}
### Suggested by Ajay Narottam Shah <ajayshah@mayin.org> in e-mail 2006/07/22
-xtable.zoo <- function(x, ...) {
- return(xtable(as.ts(x), ...))
+xtable.zoo <- function(x, caption = NULL, label = NULL, align = NULL,
+ digits = NULL, display = NULL, auto = FALSE, ...) {
+ return(xtable(as.ts(x), caption = caption, label = label,
+ align = align, digits = digits,
+ display = display, auto = auto, ...))
}
### Date: Fri, 29 May 2015 11:41:04 +0200
digits = NULL, display = NULL, auto = FALSE, ...) {
return(xtable.summary.sarlm(summary(x), caption = caption, label = label,
align = align, digits = digits,
- display = display, auto = auto))
+ display = display, auto = auto, ...))
}
xtable.summary.sarlm <- function(x, caption = NULL, label = NULL, align = NULL,
digits = NULL, display = NULL, auto = FALSE, ...) {
return(xtable.summary.sarlm(summary(x), caption = caption, label = label,
align = align, digits = digits,
- display = display, auto = auto))
+ display = display, auto = auto, ...))
}
xtable.summary.spautolm <- function(x, caption = NULL, label = NULL,
display = NULL, auto = FALSE, ...) {
return(xtable.summary.sarlm(summary(x), caption = caption, label = label,
align = align, digits = digits,
- display = display, auto = auto))
+ display = display, auto = auto, ...))
}
auto = FALSE, ...) {
return(xtable.summary.sarlm(x, caption = caption, label = label,
align = align, digits = digits,
- display = display, auto = auto))
+ display = display, auto = auto, ...))
}
### stsls objects
auto = FALSE, ...) {
return(xtable.summary.sarlm(x, caption = caption, label = label,
align = align, digits = digits,
- display = display, auto = auto))
+ display = display, auto = auto, ...))
}
### pred.sarlm objects
-xtable.sarlm.pred <- function(x, ...) {
- return(xtable(as.data.frame(x), ...))
+xtable.sarlm.pred <- function(x, caption = NULL, label = NULL, align = NULL,
+ digits = NULL, display = NULL,
+ auto = FALSE, ...) {
+ return(xtable(as.data.frame(x), caption = caption, label = label,
+ align = align, digits = digits,
+ display = display, auto = auto, ...))
}
### lagImpact objects
-xtable.lagImpact <- function(x, ...) {
- xtable(spdep:::lagImpactMat(x), ...)
+xtable.lagImpact <- function(x, caption = NULL, label = NULL, align = NULL,
+ digits = NULL, display = NULL,
+ auto = FALSE, ...) {
+ xtable(spdep:::lagImpactMat(x), caption = caption, label = label,
+ align = align, digits = digits,
+ display = display, auto = auto, ...)
}
### package splm
digits = NULL, display = NULL, auto = FALSE, ...) {
return(xtable.summary.splm(summary(x), caption = caption, label = label,
align = align, digits = digits,
- display = display, auto = auto))
+ display = display, auto = auto, ...))
}
xtable.summary.splm <- function(x, caption = NULL, label = NULL, align = NULL,
digits = NULL, display = NULL, auto = FALSE, ...) {
return(xtable.summary.splm(summary(x), caption = caption, label = label,
align = align, digits = digits,
- display = display, auto = auto))
+ display = display, auto = auto, ...))
}
xtable.summary.sphet <- function(x, caption = NULL, label = NULL, align = NULL,
auto = FALSE, ...) {
return(xtable.summary.splm(x, caption = caption, label = label,
align = align, digits = digits,
- display = display, auto = auto))
+ display = display, auto = auto, ...))
}
### ftable objects, requested by Charles Roosen
### Feature request #2248, 2/9/2012
xtableFtable <- function(x, caption = NULL, label = NULL, align = NULL,
- digits = NULL, display = NULL, auto = FALSE,
+ digits = NULL, display = NULL,
quote = TRUE,
method = c("non.compact", "row.compact",
"col.compact", "compact"),
lsep = " | ", ...) {
- ftbl <- format.ftable(x, quote = quote, digits = digits,
- method = method, lsep = lsep)
- xftbl <- xtable.matrix(ftbl,
- caption = caption, label = label, align = align,
- digits = digits, display = display, auto = auto)
- class(xftbl) <- c("xtableFtable", "data.frame")
- attributes(xftbl) <- list(attributes(xftbl), attributes(ftbl))
- return(xftbl)
+ method <- match.arg(method)
+ saveMethod <- method
+ xDim <- dim(x)
+ nRowVars <- length(attr(x, "row.vars"))
+ nColVars <- length(attr(x, "col.vars"))
+ if (nRowVars ==0){
+ if (method =="col.compact"){
+ method <- "non.compact"
+ } else if (method == "compact"){
+ method <- "row.compact"
+ }
+ }
+ if (nColVars ==0){
+ if (method =="row.compact"){
+ method <- "non.compact"
+ } else if (method == "compact"){
+ method <- "col.compact"
+ }
+ }
+ if (method == "non.compact"){
+ nCharCols <- nRowVars + 1
+ nCharRows <- nColVars + 1
+ }
+ if (method == "row.compact"){
+ nCharCols <- nRowVars + 1
+ nCharRows <- nColVars
+ }
+ if (method == "col.compact"){
+ nCharCols <- nRowVars
+ nCharRows <- nColVars + 1
+ }
+ if (method == "compact"){
+ nCharCols <- nRowVars
+ nCharRows <- nColVars
+ }
+
+ if(is.null(align)) align <- c(rep("l", nCharCols), rep("r", xDim[2]))
+ if(is.null(display)) {
+ display <- c(rep("s", nCharCols), rep("d", xDim[2]))
+ }
+
+ attr(x, "ftableCaption") <- caption
+ attr(x, "ftableLabel") <- label
+ attr(x, "ftableAlign") <- align
+ attr(x, "ftableDigits") <- digits
+ attr(x, "quote") <- quote
+ attr(x, "ftableDisplay") <- display
+ attr(x, "method") <- method
+ attr(x, "lsep") <- lsep
+ attr(x, "nChars") <- c(nCharRows, nCharCols)
+ class(x) <- c("xtableFtable", "ftable")
+ return(x)
}
print.xtableFtable <- function(x,
timestamp = getOption("xtable.timestamp", date()),
...) {
if (type == "latex"){
- if (is.null(align) {
- align <- c(rep("r", nRowVars)
- } else {
+ caption <- attr(x, "ftableCaption")
+ label <- attr(x, "ftableLabel")
+ align <- attr(x, "ftableAlign")
+ digits <- attr(x, "ftableDigits")
+ quote <- attr(x, "quote")
+ digits <- attr(x, "ftabelDigits")
+ method <- attr(x, "method")
+ lsep <- attr(x, "lsep")
+ nCharRows <- attr(x, "nChars")[1]
+ fmtFtbl <- stats:::format.ftable(x, quote = quote, digits = digits,
+ method = method, lsep = lsep)
+ attr(fmtFtbl, "caption") <- caption
+ attr(fmtFtbl, "label") <- label
+ attr(fmtFtbl, "align") <- align
+ attr(fmtFtbl, "digits") <- digits
+ attr(fmtFtbl, "quote") <- quote
+ attr(fmtFtbl, "display") <- display
+ print.xtable(fmtFtbl, hline.after = c(-1, nCharRows, dim(fmtFtbl)[1]),
+ include.rownames = FALSE, include.colnames = FALSE)
+ } else {
stop("print.xtableFtable not yet implemented for this type")
}
}