Learn R Programming

memisc (version 0.96-10)

toLatex: Additional Methods for LaTeX Representations for R objects

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

## S3 method for class 'default':
toLatex(object,\dots)
## 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",
    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",
    ...)
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{format specifier, see format. }
     useDcolumn{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{LaTeX table column format specifyer(s).}
     LaTeXdec{the decimal point in the final LaTeX output.}
     ddigits{alignment specification or digits after the decimal point.}
     useBooktabs{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{appearance of the top border of the LaTeX tabular environment.}
     midrule{how are coefficients and summary statistics
        separated in the LaTeX tabular environment.}
     cmidrule{appearance of rules under section headings.}
     bottomrule{appearance of the bottom border of the LaTeX tabular environment.}
     extrarowsep{extra code to be inserted between the column titles and the
     table body produced by toLatex. }
     ...{further argument, currently ignored.}
toLatex(diag(5))
toLatex(ftable(UCBAdmissions))
misc

Arguments