Debian Codegraph @

man/toLatexExtra.Rd

raw
1 \name{toLatex}
2 \alias{toLatex.default}
3 \alias{toLatex.ftable}
4 \alias{toLatex.matrix}
5 \alias{toLatex.data.frame}
6 \alias{toLatex.ftable_matrix}
7 \title{Additional Methods for LaTeX Representations for R objects}
8 \description{
9 Methods for the generic function \code{\link[utils]{toLatex}} of package ``\link{utils}''
10 are provided for generating LaTeX representations
11 of matrices and flat contingency tables (see \code{\link{ftable}}). Also a default method is defined
12 that coerces its first argument into a matrix and applies
13 the matrix method.
14 }
15 \usage{
16 \method{toLatex}{default}(object,\dots)
17
18 \method{toLatex}{matrix}(object,
19 show.titles=TRUE,
20 show.vars=FALSE,
21 show.xvar=show.vars,
22 show.yvar=show.vars,
23 digits=if(is.table(object)) 0 else getOption("digits"),
24 format="f",
25 useDcolumn=getOption("useDcolumn",TRUE),
26 colspec=if(useDcolumn)
27 paste("D{.}{",LaTeXdec,"}{",ddigits,"}",sep="")
28 else "r",
29 LaTeXdec=".",
30 ddigits=digits,
31 useBooktabs=getOption("useBooktabs",TRUE),
32 toprule=if(useBooktabs) "\\\\toprule" else "\\\\hline\\\\hline",
33 midrule=if(useBooktabs) "\\\\midrule" else "\\\\hline",
34 cmidrule=if(useBooktabs) "\\\\cmidrule" else "\\\\cline",
35 bottomrule=if(useBooktabs) "\\\\bottomrule" else "\\\\hline\\\\hline",
36 toLatex.escape.tex=getOption("toLatex.escape.tex",FALSE),
37 \dots)
38
39
40 \method{toLatex}{data.frame}(object,
41 digits=getOption("digits"),
42 format="f",
43 useDcolumn=getOption("useDcolumn",TRUE),
44 numeric.colspec=if(useDcolumn)
45 paste("D{.}{",LaTeXdec,"}{",ddigits,"}",sep="")
46 else "r",
47 factor.colspec="l",
48 LaTeXdec=".",
49 ddigits=digits,
50 useBooktabs=getOption("useBooktabs",TRUE),
51 toprule=if(useBooktabs) "\\\\toprule" else "\\\\hline\\\\hline",
52 midrule=if(useBooktabs) "\\\\midrule" else "\\\\hline",
53 cmidrule=if(useBooktabs) "\\\\cmidrule" else "\\\\cline",
54 bottomrule=if(useBooktabs) "\\\\bottomrule" else "\\\\hline\\\\hline",
55 row.names=is.character(attr(object,"row.names")),
56 NAas="",
57 toLatex.escape.tex=getOption("toLatex.escape.tex",FALSE),
58 \dots)
59
60 \method{toLatex}{ftable}(object,
61 show.titles=TRUE,
62 digits=if(is.integer(object)) 0 else getOption("digits"),
63 format=if(is.integer(object)) "d" else "f",
64 useDcolumn=getOption("useDcolumn",TRUE),
65 colspec=if(useDcolumn)
66 paste("D{.}{",LaTeXdec,"}{",ddigits,"}",sep="")
67 else "r",
68 LaTeXdec=".",
69 ddigits=digits,
70 useBooktabs=getOption("useBooktabs",TRUE),
71 toprule=if(useBooktabs) "\\\\toprule" else "\\\\hline\\\\hline",
72 midrule=if(useBooktabs) "\\\\midrule" else "\\\\hline\n",
73 cmidrule=if(useBooktabs) "\\\\cmidrule" else "\\\\cline",
74 bottomrule=if(useBooktabs) "\\\\bottomrule" else "\\\\hline\\\\hline",
75 extrarowsep = NULL,
76 toLatex.escape.tex=getOption("toLatex.escape.tex",FALSE),
77 fold.leaders=FALSE,
78 \dots)
79
80 \method{toLatex}{ftable_matrix}(object,
81 show.titles=TRUE,
82 digits=getOption("digits"),
83 format="f",
84 useDcolumn=getOption("useDcolumn",TRUE),
85 colspec=if(useDcolumn)
86 paste("D{.}{",LaTeXdec,"}{",ddigits,"}",sep="")
87 else "r",
88 LaTeXdec=".",
89 ddigits=digits,
90 useBooktabs=getOption("useBooktabs",TRUE),
91 toprule=if(useBooktabs) "\\\\toprule" else "\\\\hline\\\\hline",
92 midrule=if(useBooktabs) "\\\\midrule" else "\\\\hline",
93 cmidrule=if(useBooktabs) "\\\\cmidrule" else "\\\\cline",
94 bottomrule=if(useBooktabs) "\\\\bottomrule" else "\\\\hline\\\\hline",
95 compact=FALSE,
96 varontop,varinfront,
97 groupsep="3pt",
98 grouprule=midrule,
99 toLatex.escape.tex=getOption("toLatex.escape.tex",FALSE),
100 multi_digits=NULL,
101 \dots)
102 }
103 \arguments{
104 \item{object}{an \code{\link{ftable}}, a matrix or an object coercable into
105 a matrix. }
106 \item{show.titles}{logical, should variable names (in case of the
107 \code{ftable} and \code{table} methods)
108 or row and column names (in case of the \code{matrix} method) be appear
109 in the \code{LaTeX} code? }
110 \item{show.vars,show.xvar,show.yvar}{logical, should the names of the dimnames of \code{object}
111 be shown in the margins of the LaTeX tabular? Such names usually represent the
112 row and/or column variables of a two-dimensional \code{\link{table}}.
113 }
114 \item{digits}{number of significant digits.
115 }
116 \item{format}{character containing a format specifier, see \code{\link{format}}. }
117 \item{useDcolumn}{logical, should the facilities of the \code{dcolumn} LaTeX package be used?
118 Note that, if TRUE, you will need to include \code{\\usepackage{dcolumn}}
119 in the preamble of your LaTeX document.}
120 \item{colspec}{character, LaTeX table column format specifyer(s).}
121 \item{numeric.colspec}{character, LaTeX table column format
122 specifyer(s) for numeric vectors in the data frame.}
123 \item{factor.colspec}{character, LaTeX table column format
124 specifyer(s) for factors in the data frame.}
125 \item{LaTeXdec}{character, the decimal point in the final LaTeX output.}
126 \item{ddigits}{integer, digits after the decimal point.}
127 \item{useBooktabs}{logical, should the facilities of the \code{booktabs} LaTeX package be used?
128 Note that, if TRUE, you will need to include \code{\\usepackage{booktabs}}
129 in the preamble of your LaTeX document.}
130 \item{toprule}{character string, TeX code that determines the appearance of the top border of the LaTeX \code{tabular} environment.}
131 \item{midrule}{character string, TeX code that determines how coefficients and summary statistics are
132 separated in the LaTeX \code{tabular} environment.}
133 \item{cmidrule}{character string, TeX code that determines the appearance of rules under section headings.}
134 \item{bottomrule}{character string, TeX code that determines the appearance of the bottom border of the LaTeX \code{tabular} environment.}
135 \item{extrarowsep}{character string, extra code to be inserted between the column titles and the
136 table body produced by \code{toLatex}. }
137 \item{compact}{logical, if \code{TRUE}, extra column space between sub-tables
138 is suppressed. Defaults to \code{FALSE}}
139 \item{varontop}{logical, whether names of column variables should appear on top of factor levels}
140 \item{varinfront}{logical, whether names of row variables should appear in front of factor levels}
141 \item{groupsep}{character string, containing a TeX length; extra
142 vertical space inserted between sub-tables, unless \code{compact} is \code{TRUE}.}
143 \item{grouprule}{character string, TeX code that determines how
144 sub-table headings are embellished.}
145 \item{row.names}{logical, whether row names should be included in
146 exported LaTeX code.}
147 \item{NAas}{character string, how missing values should be represented.}
148 \item{toLatex.escape.tex}{logical, should symbols "$", "_", and "^" be
149 escaped with backslashes?}
150 \item{fold.leaders}{logical, if \code{TRUE}, factor levels of row
151 variables are not distributed into different columns, but
152 'folded' into a single column.}
153 \item{multi_digits}{NULL, a numeric vector, or a list. If it is a
154 list it should have as many elements as
155 the "ftable_matrix" contains columns, where each vector has
156 as many columns as the respective "ftable". If it is a
157 vector, it is put into a list with replicated elements
158 according to the "ftable" components.
159 The elements of these vectors can be used to specify a separate
160 number of digits for each column of the respective "ftable".}
161 \item{\dots}{further argument, currently ignored.}
162 }
163 \examples{
164 toLatex(diag(5))
165
166 toLatex(ftable(UCBAdmissions))
167
168 toLatex(rbind(
169 ftable(margin.table(UCBAdmissions,c(2,1))),
170 ftable(margin.table(UCBAdmissions,c(3,1)))
171 ))
172 }
173 \keyword{misc}