Learn R Programming

amp.dm (version 0.2.0)

general_tbl: General table wrapper for documentation functions

Description

This function creates a latex table

Usage

general_tbl(
  data,
  ret = "tbl",
  capt = "General table",
  align = NULL,
  outnm = NULL,
  tabenv = "longtable",
  float = FALSE,
  hlineafter = NULL,
  addtorow = list(pos = list(-1, 0), command = c("\\toprule ",
    "\\midrule\\endhead ")),
  ...
)

Value

a data frame, code for table or nothing in case a PDF file is created

Arguments

data

data frame for which the table should be created

ret

a character vector to define what kind of output should be returned (either "dfrm", "tbl", "file")

capt

character with the caption of the table

align

alignment of the table passed to R3port::ltx_list or xtable::print.xtable (see details below)

outnm

character with the name of the tex file to generate and compile, e.g. "define.tex" (only applicable in case file is returned)

tabenv

character with the tabular environment passed to xtable::print.xtable

float

logical defining float passed to xtable::print.xtable

hlineafter

a vector indicating the rows after which a horizontal line should appear passed to xtable::print.xtable

addtorow

A list containing the position of rows and commands passed to xtable::print.xtable

...

additional arguments passed to either R3port::ltx_list or xtable::print.xtable depending on what is returned

Author

Richard Hooijmaijers

Details

This function is a general function to create a xtable suitable for documentation, or directly creates an compiles a latex file using the R3port package. The align argument can be used to change the column widths of a table to be able to fit a table on a page (e.g. in latex wide tables can fall off a page). The way this should be used is to provide a vector of one with a specification for each column. For example lp{3cm}r can be used for left align first column, second column of 3 cm and third column right aligned. In case align is set to NULL a default alignment is used

Examples

Run this code

general_tbl(head(Theoph))

Run the code above in your browser using DataLab