Paste: Generate terms to paste values together in table.

Description Usage Arguments Value Examples

View source: R/Paste.R

Description

This function generates a component of a table formula to output multiple columns with punctuation between. It is designed only for LaTeX output.

Usage

1
2
Paste(..., head, digits=2, justify="c", prefix="", sep="", postfix="",
      character.only = FALSE)

Arguments

...

Expressions to be displayed in the columns of the table. If they are named, they will get those names as headings, otherwise they will not be labelled.

head

If not missing, this will be used as a column heading for the combined columns.

digits

Will be passed to the format function. If digits is length one, all columns use a common format; otherwise they are formatted separately.

justify

One or more justifications to use on the individual columns.

sep

One or more separators to use between columns.

prefix, postfix

Additional text to insert before and after the group of columns.

character.only

If TRUE, the head argument will be interpreted as an expression evaluating to a character value.

Value

An expression which will produce the requested output in LaTeX.

Examples

1
2
3
stderr <- function(x) sd(x)/sqrt(length(x))
latex( tabular( (Species+1) ~ Sepal.Length*
          PlusMinus(mean, stderr, digits=1), data=iris ) )

Example output

Loading required package: Hmisc
Loading required package: lattice
Loading required package: survival
Loading required package: Formula
Loading required package: ggplot2

Attaching package: 'Hmisc'

The following objects are masked from 'package:base':

    format.pval, round.POSIXt, trunc.POSIXt, units

\begin{tabular}{lcc}
\hline
Species  & \multicolumn{2}{c}{Sepal.Length} \\ 
\hline
setosa  & \multicolumn{1}{r@{}}{$5.01$} & \multicolumn{1}{@{ $\pm$ }l}{$0.05$} \\
versicolor  & \multicolumn{1}{r@{}}{$5.94$} & \multicolumn{1}{@{ $\pm$ }l}{$0.07$} \\
virginica  & \multicolumn{1}{r@{}}{$6.59$} & \multicolumn{1}{@{ $\pm$ }l}{$0.09$} \\
All  & \multicolumn{1}{r@{}}{$5.84$} & \multicolumn{1}{@{ $\pm$ }l}{$0.07$} \\
\hline 
\end{tabular}

tables documentation built on May 30, 2017, 4:19 a.m.