toLatexExtra: Additional Methods for LaTeX Representations for R objects

Description Usage Arguments Examples

Description

Methods for the generic function toLatex of package “utils” are provided for generating LaTeX representations of matrices and flat contingency tables (see ftable). Also a default method is defined that coerces its first argument into a matrix and applies the matrix method.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
## Default S3 method:
toLatex(object,...)

## S3 method for class 'ftable'
toLatex(object,
    show.titles=TRUE,
    digits=0,
    format="f",
    useDcolumn=TRUE,
    colspec=if(useDcolumn)
                paste("D{.}{",LaTeXdec,"}{",ddigits,"}",sep="")
             else "r",
    LaTeXdec=".",
    ddigits=digits,
    useBooktabs=TRUE,
    toprule=if(useBooktabs) "\\toprule" else "\\hline\\hline",
    midrule=if(useBooktabs) "\\midrule" else "\\hline\n",
    cmidrule=if(useBooktabs) "\\cmidrule" else "\\cline",
    bottomrule=if(useBooktabs) "\\bottomrule" else "\\hline\\hline",
    extrarowsep = NULL,
    ...)

## S3 method for class 'matrix'
toLatex(object,
    show.titles=TRUE,
    show.vars=FALSE,
    show.xvar=show.vars,
    show.yvar=show.vars,
    digits=if(is.table(object)) 0 else getOption("digits"),
    format="f",
    useDcolumn=TRUE,
    colspec=if(useDcolumn)
                paste("D{.}{",LaTeXdec,"}{",ddigits,"}",sep="")
             else "r",
    LaTeXdec=".",
    ddigits=digits,
    useBooktabs=TRUE,
    toprule=if(useBooktabs) "\\toprule" else "\\hline\\hline",
    midrule=if(useBooktabs) "\\midrule" else "\\hline",
    cmidrule=if(useBooktabs) "\\cmidrule" else "\\cline",
    bottomrule=if(useBooktabs) "\\bottomrule" else "\\hline\\hline",
    ...)

## S3 method for class 'ftable_matrix'
toLatex(object,
    show.titles=TRUE,
    digits=0,
    format="f",
    useDcolumn=TRUE,
    colspec=if(useDcolumn)
                paste("D{.}{",LaTeXdec,"}{",ddigits,"}",sep="")
             else "r",
    LaTeXdec=".",
    ddigits=digits,
    useBooktabs=TRUE,
    toprule=if(useBooktabs) "\\toprule" else "\\hline\\hline",
    midrule=if(useBooktabs) "\\midrule" else "\\hline",
    cmidrule=if(useBooktabs) "\\cmidrule" else "\\cline",
    bottomrule=if(useBooktabs) "\\bottomrule" else "\\hline\\hline",
    compact=FALSE,
    varontop,varinfront,
    groupsep="3pt",
    grouprule=midrule,
    ...)

Arguments

object

an ftable, a matrix or an object coercable into a matrix.

show.titles

logical, should variable names (in case of the ftable and table methods) or row and column names (in case of the matrix method) be appear in the LaTeX code?

show.vars,show.xvar,show.yvar

logical, should the names of the dimnames of object be shown in the margins of the LaTeX tabular? Such names usually represent the row and/or column variables of a two-dimensional table.

digits

number of significant digits.

format

chracter containing a format specifier, see format.

useDcolumn

logical, should the facilities of the dcolumn LaTeX package be used? Note that, if TRUE, you will need to include \usepackage{dcolumn} in the preamble of your LaTeX document.

colspec

character, LaTeX table column format specifyer(s).

LaTeXdec

character, the decimal point in the final LaTeX output.

ddigits

integer, digits after the decimal point.

useBooktabs

logical, should the facilities of the booktabs LaTeX package be used? Note that, if TRUE, you will need to include \usepackage{booktabs} in the preamble of your LaTeX document.

toprule

character string, TeX code that determines the appearance of the top border of the LaTeX tabular environment.

midrule

character string, TeX code that determines how coefficients and summary statistics are separated in the LaTeX tabular environment.

cmidrule

character string, TeX code that determines the appearance of rules under section headings.

bottomrule

character string, TeX code that determines the appearance of the bottom border of the LaTeX tabular environment.

extrarowsep

character string, extra code to be inserted between the column titles and the table body produced by toLatex.

compact

logical, if TRUE, extra column space between sub-tables is suppressed. Defaults to FALSE

varontop

logical, whether names of column variables should appear on top of factor levels

varinfront

logical, whether names of row variables should appear in front of factor levels

groupsep

character string, containing a TeX length; extra vertical space inserted between sub-tables, unless compact is TRUE.

grouprule

character string, TeX code that determines how sub-table headings are embellished.

...

further argument, currently ignored.

Examples

1
2
3
4
5
6
7
8

memisc documentation built on May 2, 2019, 5:45 p.m.

Related to toLatexExtra in memisc...