read_excel 读入消息 - 抑制?

bos*_*hek 5 r r-markdown readxl

我喜欢使用这个readxl包。但是,我一直将它用作 RMarkdown 文档的一部分,并且read_excel()读取文件时的一些消息在进行分析时很有用,但在尝试呈现分析时则不然。所以问题是,有什么方法可以在使用时抑制收到的消息(或与此相关的任何警告消息)read_excel?我将采用 RMarkdown 或 read_excel 解决方案。

以下是我想要抑制的消息类型的说明。出现在我的最终 Rmarkdown 文档中:

## Parsed with column specification:
## cols(
##   .default = col_character(),
##   Year = col_integer(),
##   Month = col_integer(),
##   Date = col_date(format = ""),
##   Day = col_integer(),
##   Replicate = col_integer(),
##   Time = col_integer(),
##   Depth = col_double(),
##   DenTotal = col_integer()
## )
## See spec(...) for full column specifications.
Run Code Online (Sandbox Code Playgroud)

我无法找到一种方法从 url 中读取 excel 文件,read_excel因此我无法在此处制作可重现的示例。

lmo*_*lmo 3

如果包使用该函数打印消息message,那么suppressMessages应该可以阻止打印消息。从帮助文件中?suppressMessages,,

\n\n
\n

在忽略所有 \xe2\x80\x98simple\xe2\x80\x99 诊断消息的上下文中计算其表达式。

\n
\n