knitr doesn't convert xtable output on R 3.0.2 -
i create tex table using xtable(). here's minimal example worked when used same r version on win 7.
\documentclass[a4paper,12pt,twoside]{article} \begin{document} <<load-packages,include=true,echo=true>>= library(xtable) @ <<testing-xtable,echo=true,cache=false,include=true>>= tab <- matrix(1:50,nrow=10) rownames(tab) <- letters[1:10] print( xtable( x=tab, caption="a table", label="tab", align=rep("c",times=6), digits=3, display=rep("f",times=6) ), sanitize.colnames.function=identity, include.rownames=false, table.placement="h" ) @ \end{document} instead of nice table verbatim code output of xlatex() in pdf document.
here's output of knitr:
> grdevices::pdf.options(usedingbats = false); require(knitr); opts_knit$set(concordance = true); knit('xtable.rnw', encoding='utf-8') loading required package: knitr processing file: xtable.rnw |............. | 20% ordinary text without r code |.......................... | 40% label: load-packages (with options) list of 2 $ include: logi true $ echo : logi true |....................................... | 60% ordinary text without r code |.................................................... | 80% label: testing-xtable (with options) list of 3 $ echo : logi true $ cache : logi false $ include: logi true |.................................................................| 100% ordinary text without r code output file: xtable.tex [1] "xtable.tex" > > running pdflatex on xtable.tex...completed created pdf: ~/dropbox/intern/sandbox(coding)/tex/chapter/chapter/sandbox/xtable/xtable.pdf issues: 2 badboxes the code chunk testing-xtable should echoed in final document isn't. this pdf output. i'm suspicious message ordinary text without r code. normal?
any appreciated.
use chunk option results='asis'.
Comments
Post a Comment