R:如何编织 pdf 并且只打印输出但在没有 `suppressMessages` 的情况下抑制消息?
R: How to knit pdf and only printing output but suppress messages without `suppressMessages`?
---
title: 'title'
author: "author"
output: pdf_document
---
考虑这个函数:
doSomething <- function() {
message("a message")
2
}
如果我将其放入 R Markdown 文档中:
doSomething ()
然后 PDF 中的输出将同时包含 "a message" 和从 RStudio 编织的值 2。如何在不使用 suppressMessage
函数的情况下抑制 "a message"?
```{r, message=FALSE}
doSomething ()
```
有关详细信息,请参阅 https://yihui.org/knitr/options/。
---
title: 'title'
author: "author"
output: pdf_document
---
考虑这个函数:
doSomething <- function() {
message("a message")
2
}
如果我将其放入 R Markdown 文档中:
doSomething ()
然后 PDF 中的输出将同时包含 "a message" 和从 RStudio 编织的值 2。如何在不使用 suppressMessage
函数的情况下抑制 "a message"?
```{r, message=FALSE}
doSomething ()
```
有关详细信息,请参阅 https://yihui.org/knitr/options/。