latex.table.fac | R Documentation |
The function produces LaTeX tables with summary statistics for factor variables. It makes use of the booktabs package in LaTeX to obtain tables with a nice layout.
latex.table.fac(..., caption = NULL, label = NULL,
table = c("tabular", "longtable"), align = NULL,
floating = FALSE, center = TRUE)
... |
arguments for |
caption |
(optional) character string. Caption of LaTeX table. Note that captions are suported for all tables (see also details below). |
label |
(optional) character string. Label of LaTeX table specified as
|
table |
character string. LaTeX table format, currently either
|
align |
character string. LaTeX alignment of table rows, per default
|
floating |
logical (default: |
center |
logical (default: |
This function is deprecated and only available for backward
comaptibility. Use summarize
for more flexibility.
The output requires \usepackage{booktabs}
in the LaTeX file.
Captions can be added to both, longtable
s and tabular
s.
In the latter case, captions are also suported if the table is no
floating object. In this case, the LaTeX package capt-of
is
required.
The output is printed with LaTeX style syntax highlighting to be used
e.g. in Sweave chunks with results=tex
.
Benjamin Hofner
latex.table.cont
and get_option
## Example requires package nlme to be installed and loaded
if (require("nlme")) {
## Use dataset Orthodont
data(Orthodont, package = "nlme")
## Get summary for continuous variables
latex.table.fac(Orthodont)
## Reorder data for table:
latex.table.fac(Orthodont, variables = c("Sex", "Subject"))
## What happens in the display if we introduce some missing values:
set.seed(1907)
Orthodont$Sex[sample(nrow(Orthodont), 20)] <- NA
latex.table.fac(Orthodont)
latex.table.fac(Orthodont, variables = "Sex")
## do not show statistics on missing values
latex.table.fac(Orthodont, variables = "Sex", show.NAs = FALSE)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.