\name{print.xtable} \alias{print.xtable} \title{Print Export Tables} \description{ Function returning and displaying or writing to disk the LaTeX or HTML code associated with the supplied object of class \code{xtable}. } \usage{ \method{print}{xtable}(x, type = getOption("xtable.type", "latex"), file = getOption("xtable.file", ""), append = getOption("xtable.append", FALSE), floating = getOption("xtable.floating", TRUE), floating.environment = getOption("xtable.floating.environment", "table"), table.placement = getOption("xtable.table.placement", "ht"), caption.placement = getOption("xtable.caption.placement", "bottom"), caption.width = getOption("xtable.caption.width", NULL), latex.environments = getOption("xtable.latex.environments", c("center")), tabular.environment = getOption("xtable.tabular.environment", "tabular"), size = getOption("xtable.size", NULL), hline.after = getOption("xtable.hline.after", c(-1,0,nrow(x))), NA.string = getOption("xtable.NA.string", ""), include.rownames = getOption("xtable.include.rownames", TRUE), include.colnames = getOption("xtable.include.colnames", TRUE), only.contents = getOption("xtable.only.contents", FALSE), add.to.row = getOption("xtable.add.to.row", NULL), sanitize.text.function = getOption("xtable.sanitize.text.function", NULL), sanitize.rownames.function = getOption("xtable.sanitize.rownames.function", sanitize.text.function), sanitize.colnames.function = getOption("xtable.sanitize.colnames.function", sanitize.text.function), math.style.negative = getOption("xtable.math.style.negative", FALSE), html.table.attributes = getOption("xtable.html.table.attributes", "border=1"), print.results = getOption("xtable.print.results", TRUE), format.args = getOption("xtable.format.args", NULL), rotate.rownames = getOption("xtable.rotate.rownames", FALSE), rotate.colnames = getOption("xtable.rotate.colnames", FALSE), booktabs = getOption("xtable.booktabs", FALSE), scalebox = getOption("xtable.scalebox", NULL), width = getOption("xtable.width", NULL), comment = getOption("xtable.comment", TRUE), timestamp = getOption("xtable.timestamp", date()), ...)} \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"}. Default value is \code{"latex"}.} \item{file}{Name of file where the resulting code should be saved. If \code{file=""}, output is displayed on screen. Note that the function also (invisibly) returns a character vector of the results (which can be helpful for post-processing). Default value is \code{""}.} \item{append}{If \code{TRUE} and \code{file!=""}, code will be appended to \code{file} instead of overwriting \code{file}. Default value is \code{FALSE}.} \item{floating}{If \code{TRUE} and \code{type="latex"}, the resulting table will be a floating table (using, for example, \code{\\begin\{table\}} and \code{\\end\{table\}}). See \code{floating.environment} below. Default value is \code{TRUE}. } \item{floating.environment}{If \code{floating=TRUE} and \code{type="latex"}, the resulting table uses the specified floating environment. Possible values include \code{"table"}, \code{"table*"}, and other floating environments defined in LaTeX packages. Default value is \code{"table"}.} \item{table.placement}{If \code{floating=TRUE} and \code{type="latex"}, the floating table will have placement given by \code{table.placement} where \code{table.placement} must be \code{NULL} or contain only elements of \{"h","t","b","p","!","H"\}. Default value is \code{"ht"}.} \item{caption.placement}{The caption will be placed at the bottom of the table if \code{caption.placement} is \code{"bottom"} and at the top of the table if it equals \code{"top"}. Default value is \code{"bottom"}.} \item{caption.width}{The caption will be placed in a \code{"parbox"} of the specified width if \code{caption.width} is not \code{NULL} and \code{type="latex"}. Default value is \code{NULL}.} \item{latex.environments}{If \code{floating=TRUE} and \code{type="latex"}, the specified LaTeX environments (provided as a character vector) will enclose the tabular environment. Default value is \code{"center"}. } \item{tabular.environment}{When \code{type="latex"}, the tabular environment that will be used. When working with tables that extend more than one page, using \code{tabular.environment="longtable"} with the corresponding LaTeX package (see Fairbairns, 2005) allows one to typeset them uniformly. Note that \code{floating} should be set to \code{FALSE} when using the \code{longtable} environment. Default value is \code{"tabular"}.} \item{size}{A character vector that is inserted just before the tabular environment starts. This can be used to set the font size and a variety of other table settings. Initial backslashes are automatically prefixed, if not supplied by user. Default value is \code{NULL}. } \item{hline.after}{When \code{type="latex"}, a vector of numbers between -1 and \code{nrow(x)}, inclusive, indicating the rows after which a horizontal line should appear. If \code{NULL} is used no lines are produced. Repeated values are allowed. Default value is \code{c(-1,0,nrow(x))} which means draw a line before and after the columns names and at the end of the table.} \item{NA.string}{String to be used for missing values in table entries. Default value is \code{""}.} \item{include.rownames}{If \code{TRUE} the rows names is printed. Default value is \code{TRUE}.} \item{include.colnames}{If \code{TRUE} the columns names is printed. Default value is \code{TRUE}.} \item{only.contents}{If \code{TRUE} only the rows of the table is printed. Default value is \code{FALSE}. } \item{add.to.row}{A list of two components. The first component (which should be called 'pos') is a list that contains the position of rows on which extra commands should be added at the end. The second component (which should be called 'command') is a character vector of the same length as the first component, which contains the command that should be added at the end of the specified rows. Default value is \code{NULL}, i.e. do not add commands.} \item{sanitize.text.function}{All non-numeric entries (except row and column names) are sanitized in an attempt to remove characters which have special meaning for the output format. If \code{sanitize.text.function} is not \code{NULL}, it should be a function taking a character vector and returning one, and will be used for the sanitization instead of the default internal function. Default value is \code{NULL}.} \item{sanitize.rownames.function}{Like the \code{sanitize.text.function}, but applicable to row names. The default uses the \code{sanitize.text.function}. } \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{