]> git.donarmstrong.com Git - xtable.git/blobdiff - pkg/man/xtable.Rd
Changed functions dealing with mathematical arrays and lists from xtable methods...
[xtable.git] / pkg / man / xtable.Rd
index 1416c9baa051e1ab05869a429b89a675e9007a41..f6a5af5b0b916bee1079820bb1e49a6ebc51340c 100644 (file)
@@ -7,6 +7,7 @@
 \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{
-  Function converting an R object to an \code{xtable} object, which can
+  Convert an R object to an \code{xtable} object, which can
   then be printed as a LaTeX or HTML table.
 }
 \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
@@ -47,7 +49,7 @@ xtable(x, caption = NULL, label = NULL, align = NULL, digits = NULL,
     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}. }
@@ -79,6 +81,12 @@ xtable(x, caption = NULL, label = NULL, align = NULL, digits = NULL,
     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{
@@ -88,7 +96,7 @@ xtable(x, caption = NULL, label = NULL, align = NULL, digits = NULL,
   depends on the class of \code{x}.  For example, \code{aov} objects
   produce ANOVA tables while \code{data.frame} objects produce a table
   of the entire data frame.  One can optionally provide a caption
-  (called a title in HTML) or label (called an anchor in HTML), as well
+  or label (called an anchor in HTML), as well
   as formatting specifications.  Default values for \code{align},
   \code{digits}, and \code{display} are class dependent.
 
@@ -102,20 +110,29 @@ xtable(x, caption = NULL, label = NULL, align = NULL, digits = NULL,
   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.
-  }
-  \value{An object of class \code{"xtable"} which inherits the
-  \code{data.frame} class and contains several additional attributes
-  specifying the table formatting options.
+  attributes \code{align}, \code{digits}, and \code{display}.
+}
+\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).
 }
-\seealso{\code{\link{print.xtable}}, \code{\link{caption}},
+\seealso{
+  \code{\link{print.xtable}}, \code{\link{caption}},
   \code{\link{label}}, \code{\link{align}}, \code{\link{digits}},
-  \code{\link{display}}, \code{\link{formatC}}, \code{\link{methods}}
+  \code{\link{display}}
+
+  \code{\link{autoformat}}, \code{\link{xalign}}, \code{\link{xdigits}},
+  \code{\link{xdisplay}}
 }
 \examples{
 
@@ -124,19 +141,21 @@ data(tli)
 
 ## Demonstrate data.frame
 tli.table <- xtable(tli[1:20, ])
-digits(tli.table)[c(2, 6)] <- 0
 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, ])
-digits(tli.table) <- matrix( 0:4, nrow = 20, ncol = ncol(tli)+1 )
+display(tli.table)[c(2,6)] <- "f"
+digits(tli.table) <- matrix(0:4, nrow = 20, ncol = ncol(tli)+1)
 print(tli.table)
 print(tli.table, type = "html")
 
 ## 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")