* Added some vectorization code to improve performance.
* Added "toLatex" method.
* Included "print" in the exported methods in the NAMESPACE file.
- * Added "print.result" argument to "print" that can be used to
+ * Added "print.results" argument to "print" that can be used to
suppress the printing.
+ * Added an "is.null()" check on the "table.placement" argument.
+ * Added an example of header and footer specification with longtable
+ to the vignette.
1.6-0 (2011-10-07)
* Allow "table*" as a value for "floating.environment" in print.xtable().
sanitize.colnames.function=sanitize.text.function,\r
math.style.negative=FALSE,\r
html.table.attributes="border=1",\r
- print.result=TRUE,\r
+ print.results=TRUE,\r
...) {\r
# Claudio Agostinelli <claudio@unive.it> dated 2006-07-28 hline.after\r
# By default it print an \hline before and after the columns names independently they are printed or not and at the end of the table\r
result <- result + ETABLE\r
} \r
result <- sanitize.final(result)\r
- if (print.result){\r
+ if (print.results){\r
print(result)\r
}\r
\r
dotArgs <- list(...)\r
dotArgs$x <- object\r
dotArgs$type <- "latex"\r
- dotArgs$print.result <- FALSE\r
+ dotArgs$print.results <- FALSE\r
z <- do.call("print.xtable", dotArgs)\r
\r
z <- strsplit(z, split="\n")[[1]]\r
print(x.big,tabular.environment='longtable',floating=FALSE)
@
+\subsubsection{Long tables with headers on each page}
+
+The {\tt add.to.row} argument can be used to display the header
+for a long table on each page, and to add a "continued" footer
+on all pages except the last page.
+
+<<results=tex>>=
+library(xtable)
+x<-matrix(rnorm(1000), ncol = 10)
+
+addtorow<-list()
+addtorow$pos<-list()
+addtorow$pos[[1]]<-c(0)
+addtorow$command<-c(paste(
+ "\\hline \n",
+ " \\endhead \n",
+ " \\hline \n",
+ " {\\footnotesize Continued on next page} \n",
+ " \\endfoot \n",
+ " \\endlastfoot \n",sep=""))
+x.big <- xtable(x, label = "tabbig",
+ caption = "Example of longtable spanning several pages")
+print(x.big, tabular.environment = "longtable", floating = FALSE,
+include.rownames=FALSE,add.to.row=addtorow,hline.after=c(-1) )
+@
\subsection{Sideways tables}
Remember to insert \verb|\usepackage{rotating}| in your LaTeX preamble.
\section{Suppressing Printing}
By default the {\tt print} method will print the LaTeX or HTML to standard
output and also return the character strings invisibly. The printing to
-standard output can be supproessed by specifying {\tt print.result = FALSE}.
+standard output can be suppressed by specifying {\tt print.results = FALSE}.
<<>>=
# This will print the output and store it.
x.out2 <- print(tli.table, print.results = FALSE)
@
-Formatted output can also be captured without the printing with the
-{\tt toLatex} method.
+Formatted output can also be captured without printing with the
+{\tt toLatex} method. This function returns an object of class
+{\tt "Latex"}.
<<>>=
x.ltx <- toLatex(tli.table)
sanitize.text.function=NULL, sanitize.rownames.function=sanitize.text.function,
sanitize.colnames.function=sanitize.text.function, math.style.negative=FALSE,
html.table.attributes="border=1",
- print.result=TRUE, ...)}
+ print.results=TRUE, ...)}
\arguments{
\item{x}{An object of class \code{"xtable"}.}
\item{type}{Type of table to produce. Possible values for \code{type} are \code{"latex"} or \code{"html"}.
\item{sanitize.colnames.function}{Like the \code{sanitize.text.function}, but applicable to column names. The default uses the \code{sanitize.text.function}.}
\item{math.style.negative}{In a LaTeX table, if \code{TRUE}, then use $-$ for the negative sign (as was the behavior prior to version 1.5-3). Default value is \code{FALSE}.}
\item{html.table.attributes}{In an HTML table, attributes associated with the \code{<TABLE>} tag. Default value is \code{border=1}.}
- \item{print.result}{If \code{TRUE}, the generated table is printed to standard output. Set this to \code{FALSE} if you will just be using the character vector that is returned invisibly.}
+ \item{print.results}{If \code{TRUE}, the generated table is printed to standard output. Set this to \code{FALSE} if you will just be using the character vector that is returned invisibly.}
\item{...}{Additional arguments. (Currently ignored.)}
}
\details{