\alias{xtable.glm}
\alias{xtable.lm}
\alias{xtable.matrix}
+\alias{xtable.xtableMatharray}
\alias{xtable.prcomp}
\alias{xtable.coxph}
\alias{xtable.summary.aov}
\alias{xtable.ts}
\alias{xtable.table}
\alias{xtable.zoo}
+\alias{xtable.xtableList}
\title{Create Export Tables}
\description{
Convert an R object to an \code{xtable} object, which can
}
\usage{
xtable(x, caption = NULL, label = NULL, align = NULL, digits = NULL,
- display = NULL, ...)
+ display = NULL, auto = FALSE, ...)
}
\arguments{
\item{x}{An R object of class found among \code{methods(xtable)}. See
one greater than \code{ncol(x)} if \code{x} is a
\code{data.frame}. Use \code{"l"}, \code{"r"}, and \code{"c"} to
denote left, right, and center alignment, respectively. Use
- \code{"p\{3cm\}"} etc. for a LaTeX column of the specified width. For
+ \code{"p{3cm}"} etc. for a LaTeX column of the specified width. For
HTML output the \code{"p"} alignment is interpreted as \code{"l"},
ignoring the width request. Default depends on the class of
\code{x}. }
but \code{digits} as number of \emph{significant} digits. Note that
this can lead to quite long result strings. Default depends on the
class of \code{x}.}
+ \item{auto}{
+ Logical, indicating whether to apply automatic format when no value
+ is passed to \code{align}, \code{digits}, or \code{display}. This
+ \sQuote{autoformat} (based on \code{xalign}, \code{xdigits}, and
+ \code{xdisplay}) can be useful to quickly format a typical
+ \code{matrix} or \code{data.frame}. Default value is \code{FALSE}.}
\item{...}{Additional arguments. (Currently ignored.)}
}
\details{
manipulated. All method functions should return an object whose class
is \code{c("xtable","data.frame")}. The resulting object can
have attributes \code{caption} and \code{label}, but must have
- attributes \code{align}, \code{digits}, and \code{display}. It is
- strongly recommened that you set these attributes through the provided
- replacement functions as they perform validity checks.
+ attributes \code{align}, \code{digits}, and \code{display}.
}
-\value{An object of class \code{"xtable"} which inherits the
- \code{data.frame} class and contains several additional attributes
- specifying the table formatting options.
+\value{
+ For most \code{xtable} methods, an object of class \code{"xtable"}
+ which inherits the \code{data.frame} class and contains several
+ additional attributes specifying the table formatting options.
+
+ In the case of the \code{xtableMatharray} method, an object of class
+ \code{xtableMatharray}, which the \code{xtable} and \code{data.frame}
+ classes and contains several additional attributes specifying the
+ table formatting options.
+
}
\author{David Dahl \email{dahl@stat.byu.edu} with contributions and
suggestions from many others (see source code).
\code{\link{label}}, \code{\link{align}}, \code{\link{digits}},
\code{\link{display}}
- \code{\link{xalign}}, \code{\link{xdigits}}, \code{\link{xdisplay}}
+ \code{\link{autoformat}}, \code{\link{xalign}}, \code{\link{xdigits}},
+ \code{\link{xdisplay}}
}
\examples{
tli.table <- xtable(tli[1:20, ])
print(tli.table)
print(tli.table, type = "html")
+xtable(mtcars)
+xtable(mtcars, auto = TRUE)
## Demonstrate data.frame with different digits in cells
tli.table <- xtable(tli[1:20, ])
## Demonstrate matrix
design.matrix <- model.matrix(~ sex*grade, data = tli[1:20, ])
-design.table <- xtable(design.matrix)
+design.table <- xtable(design.matrix, auto = TRUE)
print(design.table)
print(design.table, type = "html")