Learn R Programming

latexpdf (version 0.1.8)

as.ltable: Coerce to LaTeX Table Environment

Description

Coerces to LaTeX table environment. Generic, with methods for data.frame, table, and matrix.

Coerces to LaTeX table from data.frame. See details.

Coerces to ltable from table, reclassifying its argument as matrix.

Coerces to ltable from matrix; tires to capture the column names as a caption, and (like as.tabular.matrix) converts its argument to data.frame, capturing rownames as a column in the first position if rownames are suitably named.

Usage

as.ltable(x, ...)

# S3 method for data.frame as.ltable( x, caption = NULL, cap = caption, cap.top = TRUE, label = NULL, options = "H", environments = "center", source = NULL, file = NULL, source.label = "source: ", file.label = "file: ", basefile = FALSE, footnote.size = "tiny", ... )

# S3 method for table as.ltable(x, ...)

# S3 method for matrix as.ltable(x, caption = names(dimnames(x))[[2]], ...)

Value

character

Arguments

x

object

...

passed arguments

caption

full version of the caption

cap

short version of the caption, for list of tables

cap.top

Should caption be placed at the top, instead of bottom?

label

optional label

options

options for latex table environment, e.g. H or !htpb

environments

extra environments to nest between ‘table’ and ‘tabular’

source

optional source attribution

file

optional file name

source.label

optional text to preceed source if specified

file.label

optional text to preceed file if specified

basefile

if TRUE, strip path from file for display purposes

footnote.size

font size for source and file, etc.

Methods (by class)

  • as.ltable(data.frame): data.frame method

  • as.ltable(table): table method

  • as.ltable(matrix): matrix method

Details

Converts data.frame to tabular, then wraps it in specified environments, then wraps result in a latex table environment. Result is returned visibly, or if file is specified it is printed to file and returned invisibly. If source and source.label are defined, they will be printed in a tiny font immediately under the table (bound to the tabular element). If file and file.label are defined as well, they will be printed (tiny) under source. Set source.label to NULL to suppress embedding of source; set to empty string to suppress source label. Set file.label to NULL to suppress embedding of file; set to empty string to suppress file label. Note that file controls file destination, whether or not represented in the result.

Extra arguments(...) are passed to as.tabular.

See Also

as.tabular

as.tabular

Examples

Run this code
as.ltable(head(Theoph))
as.ltable(table(1:3,4:6))

Run the code above in your browser using DataLab