xtable: 'xtable' methods

Description Usage Arguments Value Note See Also Examples

View source: R/xtable.R

Description

xtable methods

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
xtable(x, caption = NULL, label = NULL, align = NULL, digits = NULL,
  display = NULL, ...)

## S3 method for class 'table'
xtable(x, caption = paste0(paste(names(dimnames(x)), collapse
  = " $\\times$ "), "\\\\ chi-sq=",
  signif(suppressWarnings(stats::chisq.test(x)$p.value), digits)),
  label = NULL, align = c("l", rep("c", dim(x)[2])), digits = 2,
  display = NULL, ...)

## S3 method for class 'survfit'
xtable(x, caption = paste0("Survival for ",
  deparse(x$call[[2]])), label = NULL, align = c("l", rep("c", 7)),
  digits = NULL, display = rep("fg", 8), ...)

Arguments

x

An object with an xtable method.

caption

Caption.

label

Label.

align

Alignment of columns.

digits

Number of digits to display.

display

How to display - passed to formatC.

...

Additional arguments (not implemented).

Value

An xtable, suitable for use with/ parsing by LaTeX.

Note

xtable.survfit - this does not show the (restricted) mean survival, only the median with confidence intervals.

See Also

? xtable ? xtable::print.xtable methods("xtable")

Examples

1
2
3
4
data("kidney", package="KMsurv")
xtable(with(kidney, table(delta, type)))
## K&M. Example 7.2, pg 210.
xtable(survfit(Surv(time=time, event=delta) ~ type, data=kidney))

Example output

Loading required package: survival
% latex table generated in R 3.4.0 by xtable 1.8-2 package
% Sat Jun  3 17:27:43 2017
\begin{table}[ht]
\centering
\begin{tabular}{lcc}
  \hline
 & type & . \\ 
  \hline
delta & 1 & 2 \\ 
  0 & 28 & 65 \\ 
  1 & 15 & 11 \\ 
   \hline
\end{tabular}
\caption{delta $\times$ type\\ chi-sq=0.018} 
\end{table}
% latex table generated in R 3.4.0 by xtable 1.8-2 package
% Sat Jun  3 17:27:43 2017
\begin{table}[ht]
\centering
\begin{tabular}{lccccccc}
  \hline
 & records & n.max & n.start & events & median & 0.95LCL & 0.95UCL \\ 
  \hline
type=1 &  43 &  43 &  43 &  15 &  18 &  16 &  \\ 
  type=2 &  76 &  76 &  76 &  11 &  &  &  \\ 
   \hline
\end{tabular}
\caption{Survival for Surv(time = time, event = delta) ~ type} 
\end{table}

survMisc documentation built on May 29, 2017, 3:50 p.m.