在 rmarkdown 中打印 heatmap.2 对象时为空输出
Null output when printing heatmap.2 object in rmarkdown
我正在通过 R-Studio
使用 rmarkdown
,并希望通过 heatmap.2
绘制 heatmap
。当我通过 strCol
选项更改列标签的角度时,我在输出 PDF 文件中的 heatmap
之前打印了一条 NULL
消息。
附上重现问题的最小代码:
{r, message=FALSE,warning=FALSE, echo=FALSE}
require(gplots)
data(mtcars)
x <- as.matrix(mtcars)
heatmap.2(x,srtCol=0)
PDF 看起来像
有什么方法可以从 PDF 输出中删除这个 NULL
吗?
尝试使用 capture.output
进行以下修改。这没有为我打印 NULL
。
```{r, message=FALSE,warning=FALSE, echo=FALSE}
require(gplots)
data(mtcars)
x <- as.matrix(mtcars)
res <- capture.output(heatmap.2(x,srtCol=0))
```
heatmap.2
的某些选项可能有更好的方法,但我没有在文档中看到它。这是基于以下 SO post Suppress one command's output in R.
我正在通过 R-Studio
使用 rmarkdown
,并希望通过 heatmap.2
绘制 heatmap
。当我通过 strCol
选项更改列标签的角度时,我在输出 PDF 文件中的 heatmap
之前打印了一条 NULL
消息。
附上重现问题的最小代码:
{r, message=FALSE,warning=FALSE, echo=FALSE}
require(gplots)
data(mtcars)
x <- as.matrix(mtcars)
heatmap.2(x,srtCol=0)
PDF 看起来像
有什么方法可以从 PDF 输出中删除这个 NULL
吗?
尝试使用 capture.output
进行以下修改。这没有为我打印 NULL
。
```{r, message=FALSE,warning=FALSE, echo=FALSE}
require(gplots)
data(mtcars)
x <- as.matrix(mtcars)
res <- capture.output(heatmap.2(x,srtCol=0))
```
heatmap.2
的某些选项可能有更好的方法,但我没有在文档中看到它。这是基于以下 SO post Suppress one command's output in R.