Load example dataset\r
<<>>=\r
library(xtable)\r
+options(xtable.floating = FALSE)\r
data(tli)\r
\r
## Demonstrate data.frame\r
digits(tli.table)[c(2,6)] <- 0\r
@\r
<<results='asis'>>=\r
-print(tli.table, floating = FALSE)\r
+tli.table\r
@\r
\r
\newpage\r
design.table <- xtable(design.matrix)\r
@\r
<<results='asis'>>=\r
-print(design.table, floating = FALSE)\r
+design.table\r
@\r
\r
\subsection{aov}\r
fm1.table <- xtable(fm1)\r
@\r
<<results='asis'>>=\r
-print(fm1.table, floating = FALSE)\r
+fm1.table\r
@\r
\subsection{lm}\r
<<>>=\r
fm2.table <- xtable(fm2)\r
@\r
<<results='asis'>>=\r
-print(fm2.table, floating = FALSE)\r
+fm2.table\r
@\r
\r
\vspace{12pt}\textbf{\itshape An anova object}\r
\r
<<results='asis'>>=\r
-print(xtable(anova(fm2)), floating = FALSE)\r
+xtable(anova(fm2))\r
@\r
\vspace{12pt}\textbf{\itshape Another anova object}\r
<<>>=\r
fm2b <- lm(tlimth ~ ethnicty, data = tli)\r
@\r
<<results='asis'>>=\r
-print(xtable(anova(fm2b, fm2)), floating = FALSE)\r
+xtable(anova(fm2b, fm2))\r
@\r
\r
\r
fm3.table <- xtable(fm3)\r
@\r
<<results='asis'>>=\r
-print(fm3.table, floating = FALSE)\r
+fm3.table\r
@\r
\r
\vspace{12pt}\textbf{\itshape An anova object}\r
<<results='asis'>>=\r
-print(xtable(anova(fm3)), floating = FALSE)\r
+xtable(anova(fm3))\r
@\r
\r
\r
options(op)\r
@\r
<<results='asis'>>=\r
-print(xtable(npk.aov), floating = FALSE)\r
+xtable(npk.aov)\r
@\r
\r
\vspace{12pt}\textbf{\itshape An anova object}\r
<<results='asis'>>=\r
-print(xtable(anova(npk.aov)), floating = FALSE)\r
+xtable(anova(npk.aov))\r
@\r
\r
\vspace{12pt}\textbf{\itshape Another anova object}\r
<<results='asis'>>=\r
-print(xtable(summary(npk.aov)), floating = FALSE)\r
+xtable(summary(npk.aov))\r
@\r
\r
<<results='asis'>>=\r
-print(xtable(npk.aovE), floating = FALSE)\r
+xtable(npk.aovE)\r
@\r
\r
\r
<<results='asis'>>=\r
-print(xtable(summary(npk.aovE)), floating = FALSE)\r
+xtable(summary(npk.aovE))\r
@\r
\r
\subsection{More lm}\r
lm.D9 <- lm(weight ~ group)\r
@\r
<<results='asis'>>=\r
-print(xtable(lm.D9), floating = FALSE)\r
+xtable(lm.D9)\r
@\r
\r
\r
<<results='asis'>>=\r
-print(xtable(anova(lm.D9)), floating = FALSE)\r
+xtable(anova(lm.D9))\r
@\r
\r
\subsection{More glm}\r
glm.D93 <- glm(counts ~ outcome + treatment, family = poisson())\r
@\r
<<results='asis'>>=\r
-print(xtable(glm.D93, align = "r|llrc"), floating = FALSE)\r
+xtable(glm.D93, align = "r|llrc")\r
@\r
\r
\subsection{prcomp}\r
}\r
@\r
<<results='asis'>>=\r
-if(require(stats, quietly = TRUE)) {\r
- print(xtable(pr1), floating = FALSE)\r
-}\r
+xtable(pr1)\r
@\r
\r
\r
<<results='asis'>>=\r
- print(xtable(summary(pr1)), floating = FALSE)\r
+xtable(summary(pr1))\r
@\r
\r
\r
# ## Demonstrate princomp\r
# ## Taken from help(princomp) in mva package of R 1.1.1\r
# pr2 <- princomp(USArrests)\r
-# print(xtable(pr2))\r
+# xtable(pr2)\r
@\r
\r
\subsection{Time series}\r
caption(temp.table) <- "Time series example"\r
@\r
<<results='asis'>>=\r
- print(temp.table, floating = FALSE)\r
+temp.table\r
@\r
<<savetofile,echo=FALSE>>=\r
if (FALSE) {\r
@\r
\r
<<pxti,results='asis'>>=\r
-print( xtable(insane), floating = FALSE)\r
+xtable(insane)\r
@\r
\r
\vspace{12pt}\r
align(tli.table) <- rep("r", 6)\r
@\r
<<results='asis'>>=\r
-print(tli.table, floating = FALSE)\r
+tli.table\r
@\r
\r
\vspace{12pt}\r
align(tli.table) <- "|rrl|l|lr|"\r
@\r
<<results='asis'>>=\r
-print(tli.table, floating = FALSE)\r
+tli.table\r
@\r
\vspace{12pt}\textbf{\itshape Fixed width columns}\r
<<>>=\r
align(tli.table) <- "|rr|lp{3cm}l|r|"\r
@\r
<<results='asis'>>=\r
-print(tli.table, floating = FALSE)\r
+tli.table\r
@\r
\r
\subsection{Significant digits}\r
digits(tli.table) <- 3\r
@\r
<<results='asis'>>=\r
-print(tli.table, floating = FALSE)\r
+tli.table\r
@\r
\r
\r
digits(tli.table) <- 1:(ncol(tli)+1)\r
@\r
<<results='asis'>>=\r
-print(tli.table, floating = FALSE)\r
+tli.table\r
@\r
\r
\vspace{12pt}\r
digits(tli.table) <- matrix( 0:4, nrow = 10, ncol = ncol(tli)+1 )\r
@\r
<<results='asis'>>=\r
-print(tli.table, floating = FALSE)\r
+tli.table\r
@\r
\r
\subsection{Suppress row names}\r
<<results='asis'>>=\r
-print((tli.table), include.rownames = FALSE, floating = FALSE)\r
+print(tli.table, include.rownames = FALSE)\r
@\r
\r
\vspace{12pt} If you want a vertical line on the left, you need to\r
align(tli.table) <- "|r|r|lp{3cm}l|r|"\r
@\r
<<results='asis'>>=\r
-print((tli.table), include.rownames = FALSE, floating = FALSE)\r
+print(tli.table, include.rownames = FALSE)\r
@\r
\r
\vspace{12pt} Revert the alignment to what is was before.\r
\r
\subsection{Suppress column names}\r
<<results='asis'>>=\r
-print((tli.table), include.colnames = FALSE, floating = FALSE)\r
+print(tli.table, include.colnames = FALSE)\r
@\r
\r
\vspace{12pt}\r
Note the doubled header lines which can be suppressed with, eg,\r
<<results='asis'>>=\r
-print(tli.table, include.colnames = FALSE, floating = FALSE,\r
+print(tli.table, include.colnames = FALSE,\r
hline.after = c(0,nrow(tli.table)))\r
@\r
\r
\subsection{Suppress row and column names}\r
<<results='asis'>>=\r
-print((tli.table), include.colnames = FALSE, include.rownames = FALSE,\r
- floating = FALSE)\r
+print(tli.table, include.colnames = FALSE, include.rownames = FALSE)\r
@\r
\r
\subsection{Rotate row and column names}\r
used to rotate the row and/or column names.\r
\r
<<results='asis'>>=\r
-print((tli.table), rotate.rownames = TRUE, rotate.colnames = TRUE)\r
+print(tli.table, rotate.rownames = TRUE, rotate.colnames = TRUE)\r
@\r
\r
\subsection{Horizontal lines}\r
horizontal lines.\r
\r
<<results='asis'>>=\r
-print(xtable(anova(glm.D93)), hline.after = c(1), floating = FALSE)\r
+print(xtable(anova(glm.D93)), hline.after = c(1))\r
@\r
\r
\vspace{12pt}\textbf{\itshape Line styles}\r
\lightrulewidth = 0.5pt\r
\r
<<results='asis'>>=\r
-print(tli.table, booktabs = TRUE, floating = FALSE)\r
+print(tli.table, booktabs = TRUE)\r
@\r
\r
\vspace{12pt}\r
@\r
This command produces the required table.\r
<<results='asis'>>=\r
-print(bktbs, booktabs = TRUE, hline.after = hlines, floating = FALSE)\r
+print(bktbs, booktabs = TRUE, hline.after = hlines)\r
@\r
\r
\r
\subsection{Table-level LaTeX}\r
<<results='asis'>>=\r
-print(xtable(anova(glm.D93)), size = "small", floating = FALSE)\r
+print(xtable(anova(glm.D93)), size = "small")\r
@\r
\r
\r
caption = 'Example of \\code{longtable} spanning several pages')\r
@\r
<<results='asis'>>=\r
-print(x.big, tabular.environment = 'longtable', floating = FALSE)\r
+print(x.big, tabular.environment = 'longtable')\r
@\r
\r
%%\r
% " \\endlastfoot \n", sep = ""))\r
%x.big2 <- xtable(x, label = "tabbig2",\r
% caption = "Example of longtable with the header on each page")\r
-%print(x.big2, tabular.environment = "longtable", floating = FALSE,\r
+%print(x.big2, tabular.environment = "longtable",\r
%include.rownames = FALSE, add.to.row = addtorow, hline.after = c(-1) )\r
%@\r
\r
@\r
\r
<<results='asis'>>=\r
-print(x.small, floating.environment = 'sidewaystable')\r
+print(x.small, floating = TRUE, floating.environment = 'sidewaystable')\r
@\r
\clearpage\r
\r