toLatex.data.frame: Convert Data Frame to LaTeX

View source: R/functions.R

toLatex.data.frameR Documentation

Convert Data Frame to LaTeX

Description

Convert data frames to character vector in LaTeX markup.

Usage

## S3 method for class 'data.frame'
toLatex(object, row.names = FALSE,
        col.handlers = list(), class.handlers = list(),
        eol = "\\\\", ...)

Arguments

object

a data.frame

row.names

include the row names as the first column

col.handlers

a list of named functions

class.handlers

a list of named functions

eol

character: the line ending; may be a vector of length greater than one

...

other arguments

Details

A method for toLatex that converts data frames into LaTeX markup. Any formatting to be applied must be specifed as a function and passed with col.handlers and class.handlers.

col.handlers take precedent over class.handlers.

Value

character

Author(s)

Enrico Schumann

See Also

toLatex

Examples

df <- data.frame(letter = letters[1:5],
                 number = runif(5),
                 stringsAsFactors = FALSE)
toLatex(df,
        col.handlers = list(letter = toupper),
        class.handlers = list(numeric = function(x) format(x, digits = 4)),
        eol = "\\[1ex]")
cat(toLatex(df,
            col.handlers = list(letter = toupper),
            class.handlers = list(numeric = function(x) format(x, digits = 4)),
            eol = "\\[1ex]"), sep = "\n")

textutils documentation built on May 29, 2024, 10:37 a.m.