简体   繁体   中英

Table from R-Code in Latex

I just get started with knitR and latex to do some reproducible research.

Now I want to create a table from a data frame with:

<<>>=
xtable(TAB)
@

My question is: How do I get the table into the latex file? I guess there should be a chunk option to evaluate the output of the R-Code for the latex-document.

Thanks in advance!


Sorry, here the formatted code that doesnt work properly:

\documentclass{article} 
\begin{document} 

<<include = FALSE>>= 
library("xtable") 
data(attitude) 
@ 

<<result='tex'>>= 
xtable(attitude) 
@ 

\end{document}

The Solution is:

<<results='asis'>>=
xtable(TAB)
@

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM