6 \title{Automatically Format Export Tables}
8 Suggest an appropriate alignment, number of digits, and display type
12 autoformat(xtab, zap = getOption("digits"))
15 xdigits(x, pad = TRUE, zap = getOption("digits"))
16 xdisplay(x, pad = TRUE)
19 \item{xtab}{an object of class \code{xtable}.}
20 \item{x}{a vector, matrix, or data frame.}
21 \item{pad}{whether to format row names, when \code{x} is
23 \item{zap}{the number of digits passed to \code{zapsmall}.}
26 \code{autoformat} returns a copy of \code{xtab}, after applying
27 \code{xalign}, \code{xdigits}, and \code{xdisplay}.
29 \code{xalign} returns a character vector consisting of \code{"l"} and
30 \code{"r"} elements, for left/right alignment.
32 \code{xdigits} returns an integer vector.
34 \code{xdisplay} returns a character vector of \code{"d"}, \code{"f"},
35 and \code{"s"} elements, for integer/double/string display.
37 \author{Arni Magnusson.}
39 \code{\link{xtable}}, \code{\link{align}}, \code{\link{digits}},
51 xdigits(mtcars, pad = FALSE)
52 xdigits(mtcars, pad = TRUE)
57 ## 3 Autoformat when xtable is created
58 xtable(mtcars, align = xalign(mtcars), digits = xdigits(mtcars),
59 display = xdisplay(mtcars))
61 ## equivalent shortcut
62 xtable(mtcars, auto = TRUE)
65 ## 4 Autoformat existing xtable
67 align(mt) <- xalign(mt)
68 digits(mt) <- xdigits(mt)
69 display(mt) <- xdisplay(mt)
71 ## equivalent shortcut