9

I am creating a rmarkdown pdf report. I used read_csv function from readr package to import some csv files in a folder. I used SuppressMessages/Warnings functions to hide all warnings/messages, but I still get the messages as below when trying to import multiple files:

It seems SuppressMessages/Warnings don't work on the parsing warnings.

## Parsed with column specification:
## cols(
## .default = col_character(),
## `Constant USD - Accrued Sum` = col_number(),
## `Units Sold Sum` = col_number()
## )

Because the report is aimed for non-technical audience, the warning messages can be a distraction. What can I do to keep this message from showing?

halfer
  • 18,701
  • 13
  • 79
  • 158
Felix Zhao
  • 349
  • 3
  • 8

2 Answers2

16

Just add col_types = cols() in the read_csv() function call

read_csv("path/to/file", col_types = cols())
Shinobi_Atobe
  • 1,214
  • 1
  • 9
  • 29
5

Add message=FALSE to the chunk header:

```{r message=FALSE}
library("readr")
test <- read_csv("example.csv")
```
Phil
  • 3,936
  • 1
  • 20
  • 31