read_excel read in messages- Suppress?

6.2k Views Asked by At

I love using the readxl package. However, I've been using it as part of an RMarkdown document and some of the read_excel() message when reading in files are useful when doing analysis but not when trying to present the analysis. So the question is, is there any way to suppress the message received (or any warning message for that matter) when using read_excel? I'll take an RMarkdown OR read_excel solution.

Here is an illustration of the type of message I'd like to suppress. The appears in my final Rmarkdown document:

## 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.

I haven't been able to find a way to read in an excel file from a url using read_excel so I'm not able to make a reproducible example here.

1

There are 1 best solutions below

0
On BEST ANSWER

If the package prints out messages using the message function, then the suppressMessages should work to prevent the messages from printing. From the help file, ?suppressMessages,

evaluates its expression in a context that ignores all ‘simple’ diagnostic messages.