From 0d3fd8c81172fcc44a9340f9f92c90ea300435a0 Mon Sep 17 00:00:00 2001 From: arnima Date: Mon, 29 Sep 2014 17:22:12 +0000 Subject: [PATCH] Whitespace commit, mainly vertical near the beginning, no change in PDF git-svn-id: svn://scm.r-forge.r-project.org/svnroot/xtable@58 edb9625f-4e0d-4859-8d74-9fd3b1da38cb --- pkg/vignettes/xtableGallery.Rnw | 65 +++++---------------------------- 1 file changed, 10 insertions(+), 55 deletions(-) diff --git a/pkg/vignettes/xtableGallery.Rnw b/pkg/vignettes/xtableGallery.Rnw index c45370d..7216df4 100644 --- a/pkg/vignettes/xtableGallery.Rnw +++ b/pkg/vignettes/xtableGallery.Rnw @@ -4,16 +4,7 @@ %\VignettePackage{xtable} % !Rnw weave = knitr % \VignetteEngine{knitr::knitr} - %************************************************************************** -% -% # $Id:$ - -% $Revision: $ -% $Author: $ -% $Date: $ - - \documentclass[article, nojss]{jss} \usepackage{amsthm} \usepackage{amsmath} @@ -22,24 +13,15 @@ \usepackage{afterpage} \usepackage{hyperref} -\title{ -The \pkg{xtable} Gallery -} -\author{Jonathan Swinton and others\\ - -} - +\title{The \pkg{xtable} Gallery} +\author{Jonathan Swinton and others\\} \Plainauthor{Jonathan Swinton, and others} %% comma-separated - \Plaintitle{The xtable Gallery} %% without formatting - \Shorttitle{\pkg{xtable} Gallery} %% a short title (if necessary) <>= library(knitr) -opts_chunk$set( -fig.path='figdir/fig', debug=TRUE, echo=TRUE -) +opts_chunk$set(fig.path='figdir/fig', debug=TRUE, echo=TRUE) options(replace.assign = TRUE, width = 60, tidy.opts = list(width.cutoff = 60)) @ @@ -51,25 +33,18 @@ options(replace.assign = TRUE, width = 60, %\usepackage{hyperref} \Abstract{ - This document gives a gallery of tables which can be made by using the \texttt{xtable} package to create \LaTeX\ output. It doubles as a regression check for the package. - } \Keywords{Reproducible research, \LaTeX} - -\Address{ - Jonathan Swinton\\ - E-mail: \email{jonathan@swintons.net} -} +\Address{Jonathan Swinton\\E-mail: \email{jonathan@swintons.net}} \begin{document} - - \section{Gallery} + \subsection{Data frame} Load example dataset <<>>= @@ -104,6 +79,7 @@ fm1.table <- xtable(fm1) <>= fm1.table @ + \subsection{lm} <<>>= fm2 <- lm(tlimth ~ sex*ethnicty, data = tli) @@ -126,11 +102,8 @@ fm2b <- lm(tlimth ~ ethnicty, data = tli) xtable(anova(fm2b, fm2)) @ - \subsection{glm} - <<>>= - ## Demonstrate glm fm3 <- glm(disadvg ~ ethnicty*grade, data = tli, family = binomial()) fm3.table <- xtable(fm3) @@ -144,10 +117,8 @@ fm3.table xtable(anova(fm3)) @ - \subsection{More aov} <<>>= - ## Demonstrate aov ## Taken from help(aov) in R 1.1.1 ## From Venables and Ripley (1997) p.210. @@ -181,14 +152,12 @@ xtable(summary(npk.aov)) xtable(npk.aovE) @ - <>= xtable(summary(npk.aovE)) @ \subsection{More lm} <<>>= - ## Demonstrate lm ## Taken from help(lm) in R 1.1.1 ## Annette Dobson (1990) "An Introduction to Generalized Linear Models". @@ -203,14 +172,12 @@ lm.D9 <- lm(weight ~ group) xtable(lm.D9) @ - <>= xtable(anova(lm.D9)) @ \subsection{More glm} <<>>= - ## Demonstrate glm ## Taken from help(glm) in R 1.1.1 ## Annette Dobson (1990) "An Introduction to Generalized Linear Models". @@ -238,13 +205,10 @@ if(require(stats, quietly = TRUE)) { xtable(pr1) @ - <>= xtable(summary(pr1)) @ - - <>= # ## Demonstrate princomp # ## Taken from help(princomp) in mva package of R 1.1.1 @@ -253,7 +217,6 @@ xtable(summary(pr1)) @ \subsection{Time series} - <<>>= temp.ts <- ts(cumsum(1 + round(rnorm(100), 0)), start = c(1954, 7), frequency = 12) @@ -309,7 +272,6 @@ x Now change the default alignment, digits and display using helper functions \texttt{xalign}, \texttt{xdigits}, and \texttt{xdisplay}. - <>= align(x) <- xalign(x) digits(x) <- xdigits(x) @@ -323,8 +285,6 @@ This produces a better format as shown below. x @ %def - - \section{Sanitization} <<>>= insane <- data.frame(Name = c("Ampersand","Greater than","Less than", @@ -353,7 +313,6 @@ print(wanttex, @ \subsection{Markup in tables} - Markup can be included in tables, including in column and row names, by using a custom \code{sanitize.text.function()}: @@ -382,6 +341,7 @@ print(xtable(money), sanitize.rownames.function = function(x) {x}) @ \section{Format examples} + \subsection{Adding a centering environment } <>= print(xtable(lm.D9, caption = "\\tt latex.environments = NULL"), @@ -391,8 +351,8 @@ print(xtable(money), sanitize.rownames.function = function(x) {x}) print(xtable(lm.D9, caption = "\\tt latex.environments = \"center\""), latex.environments = "center") @ -\subsection{Column alignment} +\subsection{Column alignment} <<>>= tli.table <- xtable(tli[1:10, ]) @ @@ -420,8 +380,6 @@ tli.table @ \subsection{Significant digits} - - Specify with a single argument <<>>= digits(tli.table) <- 3 @@ -430,7 +388,6 @@ digits(tli.table) <- 3 tli.table @ - \vspace{12pt} or one for each column, counting the row names, <<>>= @@ -494,7 +451,6 @@ print(tli.table, rotate.rownames = TRUE, rotate.colnames = TRUE) @ \subsection{Horizontal lines} - \vspace{12pt}\textbf{\itshape Line locations} Use the \texttt{hline.after} argument to specify the position of the @@ -551,18 +507,15 @@ This command produces the required table. print(bktbs, booktabs = TRUE, hline.after = hlines) @ - \subsection{Table-level LaTeX} <>= print(xtable(anova(glm.D93)), size = "small") @ - \subsection{Long tables} Remember to insert \verb|\usepackage{longtable}| in your \LaTeX preamble. <>= - ## Demonstration of longtable support. x <- matrix(rnorm(1000), ncol = 10) x.big <- xtable(x, label = 'tabbig', @@ -676,8 +629,10 @@ x.ltx \section{Acknowledgements} Most of the examples in this gallery are taken from the \texttt{xtable} documentation. + \section{R Session information} <>= toLatex(sessionInfo()) @ + \end{document} -- 2.39.2