as.ltable {latexpdf}R Documentation

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 class '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 class 'table'
as.ltable(x, ...)

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

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.

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.

Value

character

Methods (by class)

See Also

as.tabular

as.tabular

Examples

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

[Package latexpdf version 0.1.8 Index]