避免R输出通过ggnet泄漏到LaTeX中

时间:2014-07-25 06:10:13

标签: r knitr tex ggally

请考虑以下通过knitr

编译成.tex文档的MWE
\documentclass{article}


\begin{document}

<<echo=FALSE, message=FALSE, warning=FALSE>>=
library(igraph)
library(GGally)
library(network)
library(sna)

# Set up data
set.seed(123)
g <- barabasi.game(1000)

# Plot data
ggnet(g, weight.method = "indegree")

@


\end{document}

插入

\begin{verbatim}
## 1000 nodes, weighted by indegree 
## 
##    id indegree outdegree freeman
## 4   4       47         1      48
## 12 12       37         1      38
## 3   3       34         1      35
## 13 13       32         1      33
## 1   1       23         0      23
## 11 11       19         1      20
\end{verbatim}

在我的.tex。

我该如何控制它?

1 个答案:

答案 0 :(得分:2)

尝试results = 'hide'

\documentclass{article}


\begin{document}

<<echo=FALSE, message=FALSE, warning=FALSE, results = 'hide'>>=
library(igraph)
library(GGally)
library(network)
library(sna)

# Set up data
set.seed(123)
g <- barabasi.game(1000)

# Plot data
ggnet(g, weight.method = "indegree")

@


\end{document}